foxts 5.0.3 → 5.1.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/base92/index.d.ts +4 -0
- package/dist/base92/index.js +1 -0
- package/dist/base92/index.mjs +1 -0
- package/dist/empty-node/index.d.ts +1 -1
- package/dist/empty-node/index.js +1 -1
- package/dist/empty-node/index.mjs +1 -1
- package/dist/extract-error-message/index.js +1 -1
- package/dist/extract-error-message/index.mjs +1 -1
- package/dist/is-probably-ip/index.d.ts +2 -1
- package/dist/is-probably-ip/index.js +1 -1
- package/dist/is-probably-ip/index.mjs +1 -1
- package/dist/noop/index.js +1 -1
- package/dist/noop/index.mjs +1 -1
- package/dist/string-join/index.js +1 -1
- package/dist/string-join/index.mjs +1 -1
- package/dist/tagged/index.js +3 -1
- package/dist/tagged/index.mjs +3 -1
- package/package.json +20 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=[33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],t=new Uint8Array(256);for(let r=0;r<t.length;r++)t[r]=255;for(let o=0;o<92;o++)t[r[o]]=o;const o=String.fromCharCode(r[0]),e=Math.log(92)/Math.log(256),n=Math.log(256)/Math.log(92);exports.base92ToUint8Array=function(r){if(0===r.length)return new Uint8Array(0);let n=0,l=0,f=0;for(;r[n]===o;)l++,n++;const a=(r.length-n)*e+1>>>0,i=new Uint8Array(a);for(;n<r.length;){let o=t[r.charCodeAt(n)],e=0;for(let r=a-1;(0!==o||e<f)&&-1!==r;r--,e++)o+=92*i[r]>>>0,i[r]=o%256>>>0,o=o/256>>>0;if(0!==o)throw Error("Non-zero carry");f=e,n++}let h=a-f;for(;h!==a&&0===i[h];)h++;const c=new Uint8Array(l+(a-h));let g=l;for(;h!==a;)c[g++]=i[h++];return c},exports.uint8ArrayToBase92=function(t){if(0===t.length)return"";let e=0,l=0,f=0;const a=t.length;for(;f!==a&&0===t[f];)f++,e++;const i=(a-f)*n+1>>>0,h=new Uint8Array(i);for(;f!==a;){let r=t[f],o=0;for(let t=i-1;(0!==r||o<l)&&-1!==t;t--,o++)r+=256*h[t]>>>0,h[t]=r%92>>>0,r=r/92>>>0;if(0!==r)throw Error("Non-zero carry");l=o,f++}let c=i-l;for(;c!==i&&0===h[c];)c++;let g=o.repeat(e);for(;c<i;++c)g+=String.fromCharCode(r[h[c]]);return g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=[33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],t=new Uint8Array(256);for(let r=0;r<t.length;r++)t[r]=255;for(let o=0;o<92;o++)t[r[o]]=o;const o=String.fromCharCode(r[0]),e=Math.log(92)/Math.log(256),n=Math.log(256)/Math.log(92);function l(t){if(0===t.length)return"";let e=0,l=0,f=0;const a=t.length;for(;f!==a&&0===t[f];)f++,e++;const h=(a-f)*n+1>>>0,i=new Uint8Array(h);for(;f!==a;){let r=t[f],o=0;for(let t=h-1;(0!==r||o<l)&&-1!==t;t--,o++)r+=256*i[t]>>>0,i[t]=r%92>>>0,r=r/92>>>0;if(0!==r)throw Error("Non-zero carry");l=o,f++}let g=h-l;for(;g!==h&&0===i[g];)g++;let c=o.repeat(e);for(;g<h;++g)c+=String.fromCharCode(r[i[g]]);return c}function f(r){if(0===r.length)return new Uint8Array(0);let n=0,l=0,f=0;for(;r[n]===o;)l++,n++;const a=(r.length-n)*e+1>>>0,h=new Uint8Array(a);for(;n<r.length;){let o=t[r.charCodeAt(n)],e=0;for(let r=a-1;(0!==o||e<f)&&-1!==r;r--,e++)o+=92*h[r]>>>0,h[r]=o%256>>>0,o=o/256>>>0;if(0!==o)throw Error("Non-zero carry");f=e,n++}let i=a-f;for(;i!==a&&0===h[i];)i++;const g=new Uint8Array(l+(a-i));let c=l;for(;i!==a;)g[c++]=h[i++];return g}export{f as base92ToUint8Array,l as uint8ArrayToBase92};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* if you are trying to empty an Element, use `emptyElement` method instead, it will opt-in more performant method on modern browsers.
|
|
3
3
|
*/
|
|
4
4
|
declare function emptyNode(node: Node): void;
|
|
5
|
-
declare
|
|
5
|
+
declare const emptyElementModern: (element: Element) => void;
|
|
6
6
|
/**
|
|
7
7
|
* Use `Element.replaceChildren` if available, otherwise fall back to removing each child node.
|
|
8
8
|
*/
|
package/dist/empty-node/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){for(;e.firstChild;)e.removeChild(e.lastChild)}
|
|
1
|
+
"use strict";function e(e){for(;e.firstChild;)e.removeChild(e.lastChild)}const t=e=>e.replaceChildren(),r="u">typeof Element&&"replaceChildren"in Element.prototype?t:e;exports.emptyElement=r,exports.emptyElementModern=t,exports.emptyNode=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){for(;e.firstChild;)e.removeChild(e.lastChild)}
|
|
1
|
+
function e(e){for(;e.firstChild;)e.removeChild(e.lastChild)}const t=e=>e.replaceChildren(),l="u">typeof Element&&"replaceChildren"in Element.prototype?t:e;export{l as emptyElement,t as emptyElementModern,e as emptyNode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";const t="name",e="message",r="stack";function n(n){return"object"==typeof n&&!!n&&t in n&&"string"==typeof n[t]&&e in n&&"string"==typeof n[e]&&(!(r in n)||"string"==typeof n[r])}exports.extractErrorMessage=function(i,s=!0,o=!1){if(!n(i))return null;let c="";return s&&(c+=i[t],c+=": "),c+=i[e],o&&r in i&&"string"==typeof i[r]&&(c+="\n"+i[r]),c.trim()},exports.isErrorLikeObject=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const t="name",e="message",n="stack";function r(r){return"object"==typeof r&&!!r&&t in r&&"string"==typeof r[t]&&e in r&&"string"==typeof r[e]&&(!(n in r)||"string"==typeof r[n])}function i(o,s=!0,f=!1){if(!r(o))return null;let c="";return s&&(c+=o[t],c+=": "),c+=o[e],f&&n in o&&"string"==typeof o[n]&&(c+="\n"+o[n]),c.trim()}export{i as extractErrorMessage,r as isErrorLikeObject};
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare function isProbablyIpv4(hostname: string): boolean;
|
|
6
6
|
declare function isProbablyIpv6(hostname: string): boolean;
|
|
7
|
+
declare const isProbablyIp: (hostname: string) => boolean;
|
|
7
8
|
|
|
8
|
-
export { isProbablyIpv4, isProbablyIpv6 };
|
|
9
|
+
export { isProbablyIp, isProbablyIpv4, isProbablyIpv6 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function t(t){const r=t.length;if(r<7||r>15)return!1;let e=0;for(let o=0;o<r;o+=1){const r=t.charCodeAt(o);if(46===r)e+=1;else if(r<48||r>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(r-1)}function r(t){const r=t.length;if(r<3)return!1;let e=+("["===t[0]),o=r;if("]"===t[o-1]&&(o-=1),o-e>39)return!1;let n=!1;for(;e<o;e+=1){const r=t.charCodeAt(e);if(58===r)n=!0;else if((r<48||r>57)&&(r<97||r>102)&&(r<65||r>90))return!1}return n}exports.isProbablyIp=e=>t(e)||r(e),exports.isProbablyIpv4=t,exports.isProbablyIpv6=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(t){const r=t.length;if(r<7||r>15)return!1;let e=0;for(let n=0;n<r;n+=1){const r=t.charCodeAt(n);if(46===r)e+=1;else if(r<48||r>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(r-1)}function r(t){const r=t.length;if(r<3)return!1;let e=+("["===t[0]),n=r;if("]"===t[n-1]&&(n-=1),n-e>39)return!1;let o=!1;for(;e<n;e+=1){const r=t.charCodeAt(e);if(58===r)o=!0;else if((r<48||r>57)&&(r<97||r>102)&&(r<65||r>90))return!1}return o}const e=e=>t(e)||r(e);export{e as isProbablyIp,t as isProbablyIpv4,r as isProbablyIpv6};
|
package/dist/noop/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o
|
|
1
|
+
"use strict";const o=/* @__NO_SIDE_EFFECTS__ */()=>{},r=/* #__PURE__ */Promise.resolve(),e=/* #__PURE__ */new Promise(o);exports.asyncNeverFn=/* @__NO_SIDE_EFFECTS__ */()=>e,exports.asyncNoop=/* @__NO_SIDE_EFFECTS__ */()=>r,exports.falseFn=/* @__NO_SIDE_EFFECTS__ */()=>!1,exports.noop=o,exports.throwFn=/* @__NO_SIDE_EFFECTS__ */()=>{throw Error()},exports.trueFn=/* @__NO_SIDE_EFFECTS__ */()=>!0;
|
package/dist/noop/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o
|
|
1
|
+
const o=/* @__NO_SIDE_EFFECTS__ */()=>{},r=/* @__NO_SIDE_EFFECTS__ */()=>!0,e=/* @__NO_SIDE_EFFECTS__ */()=>!1,n=/* @__NO_SIDE_EFFECTS__ */()=>{throw Error()},s=/* #__PURE__ */Promise.resolve(),t=/* @__NO_SIDE_EFFECTS__ */()=>s,F=/* #__PURE__ */new Promise(o),a=/* @__NO_SIDE_EFFECTS__ */()=>F;export{a as asyncNeverFn,t as asyncNoop,e as falseFn,o as noop,n as throwFn,r as trueFn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.stringJoin=function(t,
|
|
1
|
+
"use strict";exports.stringJoin=function(t,e=",",r=!1){let n,i=t.length;if(0===i)return"";r&&(i=(t=Array.from(new Set(t))).length);let l="",o=0;for(let r=0;r<i;r++)(n=t[r])&&(o?l+=e:o=1,l+=n);return l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(r
|
|
1
|
+
function t(e,r=",",n=!1){let l,o=e.length;if(0===o)return"";n&&(o=(e=Array.from(new Set(e))).length);let f="",i=0;for(let t=0;t<o;t++)(l=e[t])&&(i?f+=r:i=1,f+=l);return f}export{t as stringJoin};
|
package/dist/tagged/index.js
CHANGED
package/dist/tagged/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -64,6 +64,12 @@
|
|
|
64
64
|
"require": "./dist/available-parallelism/index.js",
|
|
65
65
|
"default": "./dist/available-parallelism/index.js"
|
|
66
66
|
},
|
|
67
|
+
"./base92": {
|
|
68
|
+
"types": "./dist/base92/index.d.ts",
|
|
69
|
+
"import": "./dist/base92/index.mjs",
|
|
70
|
+
"require": "./dist/base92/index.js",
|
|
71
|
+
"default": "./dist/base92/index.js"
|
|
72
|
+
},
|
|
67
73
|
"./bitwise": {
|
|
68
74
|
"types": "./dist/bitwise/index.d.ts",
|
|
69
75
|
"import": "./dist/bitwise/index.mjs",
|
|
@@ -314,35 +320,35 @@
|
|
|
314
320
|
"author": "SukkaW <https://skk.moe>",
|
|
315
321
|
"license": "MIT",
|
|
316
322
|
"devDependencies": {
|
|
317
|
-
"@eslint-sukka/node": "^8.0
|
|
318
|
-
"@happy-dom/global-registrator": "^20.
|
|
323
|
+
"@eslint-sukka/node": "^8.3.0",
|
|
324
|
+
"@happy-dom/global-registrator": "^20.3.7",
|
|
319
325
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
320
326
|
"@mitata/counters": "^0.0.8",
|
|
321
|
-
"@monyone/aho-corasick": "^1.1.
|
|
327
|
+
"@monyone/aho-corasick": "^1.1.5",
|
|
322
328
|
"@package-json/types": "^0.0.12",
|
|
323
329
|
"@swc-node/register": "^1.11.1",
|
|
324
|
-
"@swc/core": "^1.15.
|
|
330
|
+
"@swc/core": "^1.15.10",
|
|
325
331
|
"@types/mocha": "^10.0.10",
|
|
326
|
-
"@types/node": "^22.19.
|
|
327
|
-
"@types/sinon": "^
|
|
328
|
-
"bumpp": "^10.
|
|
329
|
-
"eslint": "^9.39.
|
|
330
|
-
"eslint-config-sukka": "^8.0
|
|
331
|
-
"eslint-formatter-sukka": "^8.0
|
|
332
|
+
"@types/node": "^22.19.7",
|
|
333
|
+
"@types/sinon": "^21.0.0",
|
|
334
|
+
"bumpp": "^10.4.0",
|
|
335
|
+
"eslint": "^9.39.2",
|
|
336
|
+
"eslint-config-sukka": "^8.3.0",
|
|
337
|
+
"eslint-formatter-sukka": "^8.3.0",
|
|
332
338
|
"expect": "^30.2.0",
|
|
333
339
|
"fastscan": "^1.0.6",
|
|
334
|
-
"happy-dom": "^20.
|
|
340
|
+
"happy-dom": "^20.3.7",
|
|
335
341
|
"is-ci": "^4.1.0",
|
|
336
342
|
"is-network-error": "^1.3.0",
|
|
337
343
|
"mitata": "^1.0.34",
|
|
338
344
|
"mocha": "^11.7.5",
|
|
339
345
|
"modern-ahocorasick": "^2.0.4",
|
|
340
346
|
"nyc": "^17.1.0",
|
|
341
|
-
"rollup": "^4.
|
|
347
|
+
"rollup": "^4.56.0",
|
|
342
348
|
"rollup-plugin-dts": "^6.3.0",
|
|
343
349
|
"rollup-plugin-oxc-resolve": "^0.0.5",
|
|
344
350
|
"rollup-plugin-swc3": "^0.12.1",
|
|
345
|
-
"sinon": "^21.0.
|
|
351
|
+
"sinon": "^21.0.1",
|
|
346
352
|
"typescript": "^5.9.3",
|
|
347
353
|
"word-list": "3.0.0"
|
|
348
354
|
},
|