foxts 1.1.3 → 1.1.5

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/once/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";exports.once=function(t){let e,n=!1;return()=>(n||(n=!0,e=t()),e)};
@@ -0,0 +1,3 @@
1
+ declare function once<T>(fn: (() => T)): (() => T);
2
+
3
+ export { once };
package/once/index.mjs ADDED
@@ -0,0 +1 @@
1
+ function e(e){let n,t=!1;return()=>(t||(t=!0,n=e()),n)}export{e as once};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -38,15 +38,6 @@
38
38
  "require": "./add-array-elements-to-set/index.cjs",
39
39
  "default": "./add-array-elements-to-set/index.cjs"
40
40
  },
41
- "./ahocorasick": {
42
- "types": "./ahocorasick/index.d.ts",
43
- "import": {
44
- "types": "./ahocorasick/index.d.ts",
45
- "default": "./ahocorasick/index.mjs"
46
- },
47
- "require": "./ahocorasick/index.cjs",
48
- "default": "./ahocorasick/index.cjs"
49
- },
50
41
  "./append-set-elements-to-array": {
51
42
  "types": "./append-set-elements-to-array/index.d.ts",
52
43
  "import": {
@@ -65,15 +56,6 @@
65
56
  "require": "./async-write-to-stream/index.cjs",
66
57
  "default": "./async-write-to-stream/index.cjs"
67
58
  },
68
- "./bitwise": {
69
- "types": "./bitwise/index.d.ts",
70
- "import": {
71
- "types": "./bitwise/index.d.ts",
72
- "default": "./bitwise/index.mjs"
73
- },
74
- "require": "./bitwise/index.cjs",
75
- "default": "./bitwise/index.cjs"
76
- },
77
59
  "./escape-string-regexp": {
78
60
  "types": "./escape-string-regexp/index.d.ts",
79
61
  "import": {
@@ -83,6 +65,15 @@
83
65
  "require": "./escape-string-regexp/index.cjs",
84
66
  "default": "./escape-string-regexp/index.cjs"
85
67
  },
68
+ "./ahocorasick": {
69
+ "types": "./ahocorasick/index.d.ts",
70
+ "import": {
71
+ "types": "./ahocorasick/index.d.ts",
72
+ "default": "./ahocorasick/index.mjs"
73
+ },
74
+ "require": "./ahocorasick/index.cjs",
75
+ "default": "./ahocorasick/index.cjs"
76
+ },
86
77
  "./fast-string-array-join": {
87
78
  "types": "./fast-string-array-join/index.d.ts",
88
79
  "import": {
@@ -92,6 +83,15 @@
92
83
  "require": "./fast-string-array-join/index.cjs",
93
84
  "default": "./fast-string-array-join/index.cjs"
94
85
  },
86
+ "./bitwise": {
87
+ "types": "./bitwise/index.d.ts",
88
+ "import": {
89
+ "types": "./bitwise/index.d.ts",
90
+ "default": "./bitwise/index.mjs"
91
+ },
92
+ "require": "./bitwise/index.cjs",
93
+ "default": "./bitwise/index.cjs"
94
+ },
95
95
  "./fifo": {
96
96
  "types": "./fifo/index.d.ts",
97
97
  "import": {
@@ -146,6 +146,15 @@
146
146
  "require": "./identity/index.cjs",
147
147
  "default": "./identity/index.cjs"
148
148
  },
149
+ "./is-probably-ip": {
150
+ "types": "./is-probably-ip/index.d.ts",
151
+ "import": {
152
+ "types": "./is-probably-ip/index.d.ts",
153
+ "default": "./is-probably-ip/index.mjs"
154
+ },
155
+ "require": "./is-probably-ip/index.cjs",
156
+ "default": "./is-probably-ip/index.cjs"
157
+ },
149
158
  "./merge-headers": {
150
159
  "types": "./merge-headers/index.d.ts",
151
160
  "import": {
@@ -155,14 +164,14 @@
155
164
  "require": "./merge-headers/index.cjs",
156
165
  "default": "./merge-headers/index.cjs"
157
166
  },
158
- "./noop": {
159
- "types": "./noop/index.d.ts",
167
+ "./once": {
168
+ "types": "./once/index.d.ts",
160
169
  "import": {
161
- "types": "./noop/index.d.ts",
162
- "default": "./noop/index.mjs"
170
+ "types": "./once/index.d.ts",
171
+ "default": "./once/index.mjs"
163
172
  },
164
- "require": "./noop/index.cjs",
165
- "default": "./noop/index.cjs"
173
+ "require": "./once/index.cjs",
174
+ "default": "./once/index.cjs"
166
175
  },
167
176
  "./repool": {
168
177
  "types": "./repool/index.d.ts",
@@ -182,6 +191,15 @@
182
191
  "require": "./retrie/index.cjs",
183
192
  "default": "./retrie/index.cjs"
184
193
  },
194
+ "./noop": {
195
+ "types": "./noop/index.d.ts",
196
+ "import": {
197
+ "types": "./noop/index.d.ts",
198
+ "default": "./noop/index.mjs"
199
+ },
200
+ "require": "./noop/index.cjs",
201
+ "default": "./noop/index.cjs"
202
+ },
185
203
  "./serialized-memo": {
186
204
  "types": "./serialized-memo/index.d.ts",
187
205
  "import": {
@@ -217,15 +235,6 @@
217
235
  },
218
236
  "require": "./wait/index.cjs",
219
237
  "default": "./wait/index.cjs"
220
- },
221
- "./is-probably-ip": {
222
- "types": "./is-probably-ip/index.d.ts",
223
- "import": {
224
- "types": "./is-probably-ip/index.d.ts",
225
- "default": "./is-probably-ip/index.mjs"
226
- },
227
- "require": "./is-probably-ip/index.cjs",
228
- "default": "./is-probably-ip/index.cjs"
229
238
  }
230
239
  }
231
240
  }
package/retrie/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const t=new Set([".","?","*","+","^","$","|","(",")","{","}","[","]","\\"]);function e(n,o=!1){const r={},i=(t,e)=>{let n;let o=r;for(let r=0,i=t.length;r<i;++r)(n=t.charAt(r))in o||(o[n]=e?{"":""}:{}),o=o[n];o[""]=""};for(let t=0,e=n.length;t<e;++t)i(n[t],o);const s=()=>(function e(n){let o,r,i=!1,s=!1;const c=[],l=[];for(const o in n){if(!o){i=!0;continue}((r=e(n[o]))?c:l).push(("-"===o?"\\x2d":t.has(o)?"\\"+o:o)+r)}return i&&null==r?"":(s=!c.length,l.length&&c.push(l[1]?"["+l.join("")+"]":l[0]),o=c[1]?"(?:"+c.join("|")+")":c[0],i&&(o=s?o+"?":"(?:"+o+")?"),o||"")})(r);return{tree:r,add:i,toString:s,toRe:()=>new RegExp((o?"^":"")+s())}}exports.createRetrieKeywordFilter=function(t,n=!1){const o=e(t,n).toRe();return o.test.bind(o)},exports.retrie=e;
1
+ "use strict";var t=require("../noop/index.cjs");const e=new Set([".","?","*","+","^","$","|","(",")","{","}","[","]","\\"]);function n(t,r=!1){const o={},i=(t,e)=>{let n;let r=o;for(let o=0,i=t.length;o<i;++o)(n=t.charAt(o))in r||(r[n]=e?{"":""}:{}),r=r[n];r[""]=""};for(let e=0,n=t.length;e<n;++e)i(t[e],r);const s=()=>(function t(n){let r,o,i=!1,s=!1;const c=[],l=[];for(const r in n){if(!r){i=!0;continue}((o=t(n[r]))?c:l).push(("-"===r?"\\x2d":e.has(r)?"\\"+r:r)+o)}return i&&null==o?"":(s=!c.length,l.length&&c.push(l[1]?"["+l.join("")+"]":l[0]),r=c[1]?"(?:"+c.join("|")+")":c[0],i&&(r=s?r+"?":"(?:"+r+")?"),r||"")})(o);return{tree:o,add:i,toString:s,toRe:()=>new RegExp((r?"^":"")+s())}}exports.createRetrieKeywordFilter=function(e,r=!1){if(0===e.length)return t.falseFn;const o=n(e,r).toRe();return o.test.bind(o)},exports.retrie=n;
package/retrie/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Noop } from '../noop/index.js';
2
+
1
3
  interface BaseTrie {
2
4
  [key: string]: Trie;
3
5
  }
@@ -10,6 +12,6 @@ declare function retrie(keywords: ArrayLike<string>, asPrefixes?: boolean): {
10
12
  toString: () => string;
11
13
  toRe: () => RegExp;
12
14
  };
13
- declare function createRetrieKeywordFilter(keywords: ArrayLike<string>, asPrefixes?: boolean): (string: string) => boolean;
15
+ declare function createRetrieKeywordFilter(keywords: ArrayLike<string>, asPrefixes?: boolean): Noop<false> | ((string: string) => boolean);
14
16
 
15
17
  export { createRetrieKeywordFilter, retrie };
package/retrie/index.mjs CHANGED
@@ -1 +1 @@
1
- const t=new Set([".","?","*","+","^","$","|","(",")","{","}","[","]","\\"]);function e(n,o=!1){const r={},i=(t,e)=>{let n;let o=r;for(let r=0,i=t.length;r<i;++r)(n=t.charAt(r))in o||(o[n]=e?{"":""}:{}),o=o[n];o[""]=""};for(let t=0,e=n.length;t<e;++t)i(n[t],o);const c=()=>(function e(n){let o,r,i=!1,c=!1;const l=[],s=[];for(const o in n){if(!o){i=!0;continue}((r=e(n[o]))?l:s).push(("-"===o?"\\x2d":t.has(o)?"\\"+o:o)+r)}return i&&null==r?"":(c=!l.length,s.length&&l.push(s[1]?"["+s.join("")+"]":s[0]),o=l[1]?"(?:"+l.join("|")+")":l[0],i&&(o=c?o+"?":"(?:"+o+")?"),o||"")})(r);return{tree:r,add:i,toString:c,toRe:()=>new RegExp((o?"^":"")+c())}}function n(t,o=!1){const r=e(t,o).toRe();return r.test.bind(r)}export{n as createRetrieKeywordFilter,e as retrie};
1
+ import{falseFn as t}from"../noop/index.mjs";const n=new Set([".","?","*","+","^","$","|","(",")","{","}","[","]","\\"]);function e(t,o=!1){const r={},i=(t,n)=>{let e;let o=r;for(let r=0,i=t.length;r<i;++r)(e=t.charAt(r))in o||(o[e]=n?{"":""}:{}),o=o[e];o[""]=""};for(let n=0,e=t.length;n<e;++n)i(t[n],o);const l=()=>(function t(e){let o,r,i=!1,l=!1;const c=[],s=[];for(const o in e){if(!o){i=!0;continue}((r=t(e[o]))?c:s).push(("-"===o?"\\x2d":n.has(o)?"\\"+o:o)+r)}return i&&null==r?"":(l=!c.length,s.length&&c.push(s[1]?"["+s.join("")+"]":s[0]),o=c[1]?"(?:"+c.join("|")+")":c[0],i&&(o=l?o+"?":"(?:"+o+")?"),o||"")})(r);return{tree:r,add:i,toString:l,toRe:()=>new RegExp((o?"^":"")+l())}}function o(n,r=!1){if(0===n.length)return t;const i=e(n,r).toRe();return i.test.bind(i)}export{o as createRetrieKeywordFilter,e as retrie};