foxts 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Escape characters with special meaning either inside or outside character sets.
|
|
3
3
|
* Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
4
|
+
*
|
|
5
|
+
* When the `unicodeMode` is `true` (default), the `-` character is escaped as `\x2d` to ensure compatibility with Unicode patterns, PCRE, and MongoDB.
|
|
6
|
+
*
|
|
7
|
+
* You should disable this option if you are using JavaScript regular expressions without the `u` flag.
|
|
4
8
|
*/
|
|
5
|
-
declare function escapeStringRegexp(str: string): string;
|
|
9
|
+
declare function escapeStringRegexp(str: string, unicodeMode?: boolean): string;
|
|
6
10
|
|
|
7
11
|
export { escapeStringRegexp };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0});const e=/[$()*+.?[\\\]^{|}-]/;exports.escapeStringRegexp=function(
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0});const e=/[$()*+.?[\\\]^{|}]/,a=/[$()*+.?[\\\]^{|}-]/;exports.escapeStringRegexp=function(r,c=!0){let s=(c?a:e).exec(r);if(null===s)return r;let t="",b="",k=s.index,n=0;for(let e=r.length;k<e;k++){switch(r.charCodeAt(k)){case 92:t="\\\\";break;case 94:t="\\^";break;case 36:t="\\$";break;case 46:t="\\.";break;case 42:t="\\*";break;case 43:t="\\+";break;case 63:t="\\?";break;case 40:t="\\(";break;case 41:t="\\)";break;case 91:t="\\[";break;case 93:t="\\]";break;case 123:t="\\{";break;case 125:t="\\}";break;case 124:t="\\|";break;case 45:t=c?"\\x2d":"-";break;default:continue}n!==k&&(b+=r.slice(n,k)),n=k+1,b+=t}return n!==k&&(b+=r.slice(n,k)),b};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Escape characters with special meaning either inside or outside character sets.
|
|
3
3
|
* Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
4
|
+
*
|
|
5
|
+
* When the `unicodeMode` is `true` (default), the `-` character is escaped as `\x2d` to ensure compatibility with Unicode patterns, PCRE, and MongoDB.
|
|
6
|
+
*
|
|
7
|
+
* You should disable this option if you are using JavaScript regular expressions without the `u` flag.
|
|
4
8
|
*/
|
|
5
|
-
declare function escapeStringRegexp(str: string): string;
|
|
9
|
+
declare function escapeStringRegexp(str: string, unicodeMode?: boolean): string;
|
|
6
10
|
|
|
7
11
|
export { escapeStringRegexp };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=/[$()*+.?[\\\]^{|}-]/;function
|
|
1
|
+
let e=/[$()*+.?[\\\]^{|}]/,a=/[$()*+.?[\\\]^{|}-]/;function c(r,s=!0){let b=(s?a:e).exec(r);if(null===b)return r;let k="",t="",l=b.index,n=0;for(let e=r.length;l<e;l++){switch(r.charCodeAt(l)){case 92:k="\\\\";break;case 94:k="\\^";break;case 36:k="\\$";break;case 46:k="\\.";break;case 42:k="\\*";break;case 43:k="\\+";break;case 63:k="\\?";break;case 40:k="\\(";break;case 41:k="\\)";break;case 91:k="\\[";break;case 93:k="\\]";break;case 123:k="\\{";break;case 125:k="\\}";break;case 124:k="\\|";break;case 45:k=s?"\\x2d":"-";break;default:continue}n!==l&&(t+=r.slice(n,l)),n=l+1,t+=k}return n!==l&&(t+=r.slice(n,l)),t}export{c as escapeStringRegexp};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -339,45 +339,37 @@
|
|
|
339
339
|
"author": "SukkaW <https://skk.moe>",
|
|
340
340
|
"license": "MIT",
|
|
341
341
|
"dependencies": {
|
|
342
|
-
"fast-escape-html": "^1.0
|
|
342
|
+
"fast-escape-html": "^1.1.0"
|
|
343
343
|
},
|
|
344
344
|
"devDependencies": {
|
|
345
|
-
"@eslint-sukka/node": "^6.
|
|
345
|
+
"@eslint-sukka/node": "^6.22.1",
|
|
346
346
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
347
347
|
"@mitata/counters": "^0.0.8",
|
|
348
348
|
"@monyone/aho-corasick": "^1.0.4",
|
|
349
|
-
"@napi-rs/escape": "^1.0.1",
|
|
350
349
|
"@package-json/types": "^0.0.11",
|
|
351
350
|
"@swc-node/register": "^1.10.10",
|
|
352
|
-
"@swc/core": "^1.
|
|
353
|
-
"@types/escape-html": "^1.0.4",
|
|
351
|
+
"@swc/core": "^1.12.4",
|
|
354
352
|
"@types/escape-regexp": "^0.0.3",
|
|
355
|
-
"@types/html-escaper": "^3.0.4",
|
|
356
|
-
"@types/lodash.escape": "^4.0.9",
|
|
357
353
|
"@types/lodash.escaperegexp": "^4.1.9",
|
|
358
354
|
"@types/mocha": "^10.0.10",
|
|
359
|
-
"@types/node": "^22.15.
|
|
355
|
+
"@types/node": "^22.15.32",
|
|
360
356
|
"@types/regex-escape": "^3.4.1",
|
|
361
357
|
"@types/sinon": "^17.0.4",
|
|
362
|
-
"bumpp": "^10.
|
|
363
|
-
"bunchee": "^6.5.
|
|
358
|
+
"bumpp": "^10.2.0",
|
|
359
|
+
"bunchee": "^6.5.3",
|
|
364
360
|
"devalue": "^5.1.1",
|
|
365
|
-
"escape-goat": "^3.0.0",
|
|
366
|
-
"escape-html": "^1.0.3",
|
|
367
361
|
"escape-regexp": "^0.0.1",
|
|
368
362
|
"escape-string-regexp": "4",
|
|
369
|
-
"eslint": "^9.
|
|
370
|
-
"eslint-config-sukka": "^6.
|
|
371
|
-
"eslint-formatter-sukka": "^6.
|
|
372
|
-
"expect": "^
|
|
363
|
+
"eslint": "^9.29.0",
|
|
364
|
+
"eslint-config-sukka": "^6.22.1",
|
|
365
|
+
"eslint-formatter-sukka": "^6.22.1",
|
|
366
|
+
"expect": "^30.0.2",
|
|
373
367
|
"fastscan": "^1.0.6",
|
|
374
|
-
"fdir": "^6.4.
|
|
368
|
+
"fdir": "^6.4.6",
|
|
375
369
|
"hexo-util": "^3.3.0",
|
|
376
|
-
"html-escaper": "2.0.2",
|
|
377
|
-
"lodash.escape": "^4.0.1",
|
|
378
370
|
"lodash.escaperegexp": "^4.1.2",
|
|
379
371
|
"mitata": "^1.0.34",
|
|
380
|
-
"mocha": "^11.
|
|
372
|
+
"mocha": "^11.7.0",
|
|
381
373
|
"modern-ahocorasick": "^2.0.4",
|
|
382
374
|
"nyc": "^17.1.0",
|
|
383
375
|
"regex-escape": "^3.4.11",
|