aboutsummaryrefslogtreecommitdiff
path: root/node_modules/regenerate/regenerate.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/regenerate/regenerate.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/regenerate/regenerate.js')
-rw-r--r--node_modules/regenerate/regenerate.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/node_modules/regenerate/regenerate.js b/node_modules/regenerate/regenerate.js
index fb849c5eb..8bca8a077 100644
--- a/node_modules/regenerate/regenerate.js
+++ b/node_modules/regenerate/regenerate.js
@@ -533,13 +533,21 @@
else if (codePoint == 0x0D) {
string = '\\r';
}
+ else if (codePoint == 0x2D) {
+ // https://mathiasbynens.be/notes/javascript-escapes#hexadecimal
+ // Note: `-` (U+002D HYPHEN-MINUS) is escaped in this way rather
+ // than by backslash-escaping, in case the output is used outside
+ // of a character class in a `u` RegExp. /\-/u throws, but
+ // /\x2D/u is fine.
+ string = '\\x2D';
+ }
else if (codePoint == 0x5C) {
string = '\\\\';
}
else if (
codePoint == 0x24 ||
(codePoint >= 0x28 && codePoint <= 0x2B) ||
- (codePoint >= 0x2D && codePoint <= 0x2F) ||
+ codePoint == 0x2E || codePoint == 0x2F ||
codePoint == 0x3F ||
(codePoint >= 0x5B && codePoint <= 0x5E) ||
(codePoint >= 0x7B && codePoint <= 0x7D)
@@ -547,9 +555,10 @@
// The code point maps to an unsafe printable ASCII character;
// backslash-escape it. Here’s the list of those symbols:
//
- // $()*+-./?[\]^{|}
+ // $()*+./?[\]^{|}
//
- // See #7 for more info.
+ // This matches SyntaxCharacters as well as `/` (U+002F SOLIDUS).
+ // https://tc39.github.io/ecma262/#prod-SyntaxCharacter
string = '\\' + stringFromCharCode(codePoint);
}
else if (codePoint >= 0x20 && codePoint <= 0x7E) {
@@ -563,7 +572,6 @@
string = stringFromCharCode(codePoint);
}
else if (codePoint <= 0xFF) {
- // https://mathiasbynens.be/notes/javascript-escapes#hexadecimal
string = '\\x' + pad(hex(codePoint), 2);
}
else { // `codePoint <= 0xFFFF` holds true.