File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## v2.3.1
4+
5+ - Fix ` invalid regexp group ` error in browsers or environments that do not support the negative lookbehind regular expression assertion.
6+
37## v2.3.0
48
59- Accept the ` Error ` constructor as ` circularValue ` option to throw on circular references as the regular JSON.stringify would:
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ exports.configure = configure
1818module . exports = stringify
1919
2020// eslint-disable-next-line
21- const strEscapeSequencesRegExp = / [ \u0000 - \u001f \u0022 \u005c \ud800 - \udfff ] | [ \ud800 - \udbff ] (? ! [ \udc00 - \udfff ] ) | (?< ! [ \ud800 - \udbff ] ) [ \udc00 - \udfff ] /
21+ const strEscapeSequencesRegExp = / [ \u0000 - \u001f \u0022 \u005c \ud800 - \udfff ] | [ \ud800 - \udbff ] (? ! [ \udc00 - \udfff ] ) | (?: [ ^ \ud800 - \udbff ] | ^ ) [ \udc00 - \udfff ] /
2222// eslint-disable-next-line
23- const strEscapeSequencesReplacer = / [ \u0000 - \u001f \u0022 \u005c \ud800 - \udfff ] | [ \ud800 - \udbff ] (? ! [ \udc00 - \udfff ] ) | (?< ! [ \ud800 - \udbff ] ) [ \udc00 - \udfff ] / g
23+ const strEscapeSequencesReplacer = / [ \u0000 - \u001f \u0022 \u005c \ud800 - \udfff ] | [ \ud800 - \udbff ] (? ! [ \udc00 - \udfff ] ) | (?: [ ^ \ud800 - \udbff ] | ^ ) [ \udc00 - \udfff ] / g
2424
2525// Escaped special characters. Use empty strings to fill up unused entries.
2626const meta = [
@@ -40,6 +40,10 @@ const meta = [
4040]
4141
4242function escapeFn ( str ) {
43+ if ( str . length === 2 ) {
44+ const charCode = str . charCodeAt ( 1 )
45+ return `${ str [ 0 ] } \\u${ charCode . toString ( 16 ) } `
46+ }
4347 const charCode = str . charCodeAt ( 0 )
4448 return meta . length > charCode
4549 ? meta [ charCode ]
Original file line number Diff line number Diff line change 11{
22 "name" : " safe-stable-stringify" ,
3- "version" : " 2.3.0 " ,
3+ "version" : " 2.3.1 " ,
44 "description" : " Deterministic and safely JSON.stringify to quickly serialize JavaScript objects" ,
55 "exports" : {
66 "require" : " ./index.js" ,
You can’t perform that action at this time.
0 commit comments