foxts 3.4.0 → 3.6.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.
- package/dist/cjs/escape-string-regexp.d.ts +5 -1
- package/dist/cjs/escape-string-regexp.js +1 -1
- package/dist/cjs/fast-ip-version.d.ts +6 -0
- package/dist/cjs/fast-ip-version.js +1 -0
- package/dist/es/escape-string-regexp.d.mts +5 -1
- package/dist/es/escape-string-regexp.mjs +1 -1
- package/dist/es/fast-ip-version.d.mts +6 -0
- package/dist/es/fast-ip-version.mjs +1 -0
- package/package.json +23 -21
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.fastIpVersion=function(e){return e.includes(":")?6:4*!!e.includes(".")};
|
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){return n.includes(":")?6:4*!!n.includes(".")}export{n as fastIpVersion};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -328,6 +328,16 @@
|
|
|
328
328
|
"types": "./dist/cjs/string-join.d.ts",
|
|
329
329
|
"default": "./dist/cjs/string-join.js"
|
|
330
330
|
}
|
|
331
|
+
},
|
|
332
|
+
"./fast-ip-version": {
|
|
333
|
+
"import": {
|
|
334
|
+
"types": "./dist/es/fast-ip-version.d.mts",
|
|
335
|
+
"default": "./dist/es/fast-ip-version.mjs"
|
|
336
|
+
},
|
|
337
|
+
"require": {
|
|
338
|
+
"types": "./dist/cjs/fast-ip-version.d.ts",
|
|
339
|
+
"default": "./dist/cjs/fast-ip-version.js"
|
|
340
|
+
}
|
|
331
341
|
}
|
|
332
342
|
},
|
|
333
343
|
"sideEffects": false,
|
|
@@ -339,45 +349,37 @@
|
|
|
339
349
|
"author": "SukkaW <https://skk.moe>",
|
|
340
350
|
"license": "MIT",
|
|
341
351
|
"dependencies": {
|
|
342
|
-
"fast-escape-html": "^1.0
|
|
352
|
+
"fast-escape-html": "^1.1.0"
|
|
343
353
|
},
|
|
344
354
|
"devDependencies": {
|
|
345
|
-
"@eslint-sukka/node": "^6.
|
|
355
|
+
"@eslint-sukka/node": "^6.22.1",
|
|
346
356
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
347
357
|
"@mitata/counters": "^0.0.8",
|
|
348
358
|
"@monyone/aho-corasick": "^1.0.4",
|
|
349
|
-
"@napi-rs/escape": "^1.0.1",
|
|
350
359
|
"@package-json/types": "^0.0.11",
|
|
351
360
|
"@swc-node/register": "^1.10.10",
|
|
352
|
-
"@swc/core": "^1.
|
|
353
|
-
"@types/escape-html": "^1.0.4",
|
|
361
|
+
"@swc/core": "^1.12.4",
|
|
354
362
|
"@types/escape-regexp": "^0.0.3",
|
|
355
|
-
"@types/html-escaper": "^3.0.4",
|
|
356
|
-
"@types/lodash.escape": "^4.0.9",
|
|
357
363
|
"@types/lodash.escaperegexp": "^4.1.9",
|
|
358
364
|
"@types/mocha": "^10.0.10",
|
|
359
|
-
"@types/node": "^22.15.
|
|
365
|
+
"@types/node": "^22.15.32",
|
|
360
366
|
"@types/regex-escape": "^3.4.1",
|
|
361
367
|
"@types/sinon": "^17.0.4",
|
|
362
|
-
"bumpp": "^10.
|
|
363
|
-
"bunchee": "^6.5.
|
|
368
|
+
"bumpp": "^10.2.0",
|
|
369
|
+
"bunchee": "^6.5.3",
|
|
364
370
|
"devalue": "^5.1.1",
|
|
365
|
-
"escape-goat": "^3.0.0",
|
|
366
|
-
"escape-html": "^1.0.3",
|
|
367
371
|
"escape-regexp": "^0.0.1",
|
|
368
372
|
"escape-string-regexp": "4",
|
|
369
|
-
"eslint": "^9.
|
|
370
|
-
"eslint-config-sukka": "^6.
|
|
371
|
-
"eslint-formatter-sukka": "^6.
|
|
372
|
-
"expect": "^
|
|
373
|
+
"eslint": "^9.29.0",
|
|
374
|
+
"eslint-config-sukka": "^6.22.1",
|
|
375
|
+
"eslint-formatter-sukka": "^6.22.1",
|
|
376
|
+
"expect": "^30.0.2",
|
|
373
377
|
"fastscan": "^1.0.6",
|
|
374
|
-
"fdir": "^6.4.
|
|
378
|
+
"fdir": "^6.4.6",
|
|
375
379
|
"hexo-util": "^3.3.0",
|
|
376
|
-
"html-escaper": "2.0.2",
|
|
377
|
-
"lodash.escape": "^4.0.1",
|
|
378
380
|
"lodash.escaperegexp": "^4.1.2",
|
|
379
381
|
"mitata": "^1.0.34",
|
|
380
|
-
"mocha": "^11.
|
|
382
|
+
"mocha": "^11.7.0",
|
|
381
383
|
"modern-ahocorasick": "^2.0.4",
|
|
382
384
|
"nyc": "^17.1.0",
|
|
383
385
|
"regex-escape": "^3.4.11",
|