foxts 1.1.2 → 1.1.4
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/package.json +55 -55
- package/retrie/index.cjs +1 -1
- package/retrie/index.d.ts +10 -1
- package/retrie/index.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -38,23 +38,14 @@
|
|
|
38
38
|
"require": "./add-array-elements-to-set/index.cjs",
|
|
39
39
|
"default": "./add-array-elements-to-set/index.cjs"
|
|
40
40
|
},
|
|
41
|
-
"./
|
|
42
|
-
"types": "./
|
|
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
|
-
"./async-write-to-stream": {
|
|
51
|
-
"types": "./async-write-to-stream/index.d.ts",
|
|
41
|
+
"./append-set-elements-to-array": {
|
|
42
|
+
"types": "./append-set-elements-to-array/index.d.ts",
|
|
52
43
|
"import": {
|
|
53
|
-
"types": "./
|
|
54
|
-
"default": "./
|
|
44
|
+
"types": "./append-set-elements-to-array/index.d.ts",
|
|
45
|
+
"default": "./append-set-elements-to-array/index.mjs"
|
|
55
46
|
},
|
|
56
|
-
"require": "./
|
|
57
|
-
"default": "./
|
|
47
|
+
"require": "./append-set-elements-to-array/index.cjs",
|
|
48
|
+
"default": "./append-set-elements-to-array/index.cjs"
|
|
58
49
|
},
|
|
59
50
|
"./bitwise": {
|
|
60
51
|
"types": "./bitwise/index.d.ts",
|
|
@@ -65,14 +56,14 @@
|
|
|
65
56
|
"require": "./bitwise/index.cjs",
|
|
66
57
|
"default": "./bitwise/index.cjs"
|
|
67
58
|
},
|
|
68
|
-
"./
|
|
69
|
-
"types": "./
|
|
59
|
+
"./ahocorasick": {
|
|
60
|
+
"types": "./ahocorasick/index.d.ts",
|
|
70
61
|
"import": {
|
|
71
|
-
"types": "./
|
|
72
|
-
"default": "./
|
|
62
|
+
"types": "./ahocorasick/index.d.ts",
|
|
63
|
+
"default": "./ahocorasick/index.mjs"
|
|
73
64
|
},
|
|
74
|
-
"require": "./
|
|
75
|
-
"default": "./
|
|
65
|
+
"require": "./ahocorasick/index.cjs",
|
|
66
|
+
"default": "./ahocorasick/index.cjs"
|
|
76
67
|
},
|
|
77
68
|
"./escape-string-regexp": {
|
|
78
69
|
"types": "./escape-string-regexp/index.d.ts",
|
|
@@ -83,6 +74,15 @@
|
|
|
83
74
|
"require": "./escape-string-regexp/index.cjs",
|
|
84
75
|
"default": "./escape-string-regexp/index.cjs"
|
|
85
76
|
},
|
|
77
|
+
"./async-write-to-stream": {
|
|
78
|
+
"types": "./async-write-to-stream/index.d.ts",
|
|
79
|
+
"import": {
|
|
80
|
+
"types": "./async-write-to-stream/index.d.ts",
|
|
81
|
+
"default": "./async-write-to-stream/index.mjs"
|
|
82
|
+
},
|
|
83
|
+
"require": "./async-write-to-stream/index.cjs",
|
|
84
|
+
"default": "./async-write-to-stream/index.cjs"
|
|
85
|
+
},
|
|
86
86
|
"./fast-string-array-join": {
|
|
87
87
|
"types": "./fast-string-array-join/index.d.ts",
|
|
88
88
|
"import": {
|
|
@@ -101,15 +101,6 @@
|
|
|
101
101
|
"require": "./fifo/index.cjs",
|
|
102
102
|
"default": "./fifo/index.cjs"
|
|
103
103
|
},
|
|
104
|
-
"./fnv1a52": {
|
|
105
|
-
"types": "./fnv1a52/index.d.ts",
|
|
106
|
-
"import": {
|
|
107
|
-
"types": "./fnv1a52/index.d.ts",
|
|
108
|
-
"default": "./fnv1a52/index.mjs"
|
|
109
|
-
},
|
|
110
|
-
"require": "./fnv1a52/index.cjs",
|
|
111
|
-
"default": "./fnv1a52/index.cjs"
|
|
112
|
-
},
|
|
113
104
|
"./fnv1a": {
|
|
114
105
|
"types": "./fnv1a/index.d.ts",
|
|
115
106
|
"import": {
|
|
@@ -119,14 +110,14 @@
|
|
|
119
110
|
"require": "./fnv1a/index.cjs",
|
|
120
111
|
"default": "./fnv1a/index.cjs"
|
|
121
112
|
},
|
|
122
|
-
"./
|
|
123
|
-
"types": "./
|
|
113
|
+
"./fnv1a52": {
|
|
114
|
+
"types": "./fnv1a52/index.d.ts",
|
|
124
115
|
"import": {
|
|
125
|
-
"types": "./
|
|
126
|
-
"default": "./
|
|
116
|
+
"types": "./fnv1a52/index.d.ts",
|
|
117
|
+
"default": "./fnv1a52/index.mjs"
|
|
127
118
|
},
|
|
128
|
-
"require": "./
|
|
129
|
-
"default": "./
|
|
119
|
+
"require": "./fnv1a52/index.cjs",
|
|
120
|
+
"default": "./fnv1a52/index.cjs"
|
|
130
121
|
},
|
|
131
122
|
"./headers-to-object": {
|
|
132
123
|
"types": "./headers-to-object/index.d.ts",
|
|
@@ -173,15 +164,6 @@
|
|
|
173
164
|
"require": "./noop/index.cjs",
|
|
174
165
|
"default": "./noop/index.cjs"
|
|
175
166
|
},
|
|
176
|
-
"./repool": {
|
|
177
|
-
"types": "./repool/index.d.ts",
|
|
178
|
-
"import": {
|
|
179
|
-
"types": "./repool/index.d.ts",
|
|
180
|
-
"default": "./repool/index.mjs"
|
|
181
|
-
},
|
|
182
|
-
"require": "./repool/index.cjs",
|
|
183
|
-
"default": "./repool/index.cjs"
|
|
184
|
-
},
|
|
185
167
|
"./retrie": {
|
|
186
168
|
"types": "./retrie/index.d.ts",
|
|
187
169
|
"import": {
|
|
@@ -191,6 +173,15 @@
|
|
|
191
173
|
"require": "./retrie/index.cjs",
|
|
192
174
|
"default": "./retrie/index.cjs"
|
|
193
175
|
},
|
|
176
|
+
"./repool": {
|
|
177
|
+
"types": "./repool/index.d.ts",
|
|
178
|
+
"import": {
|
|
179
|
+
"types": "./repool/index.d.ts",
|
|
180
|
+
"default": "./repool/index.mjs"
|
|
181
|
+
},
|
|
182
|
+
"require": "./repool/index.cjs",
|
|
183
|
+
"default": "./repool/index.cjs"
|
|
184
|
+
},
|
|
194
185
|
"./serialized-memo": {
|
|
195
186
|
"types": "./serialized-memo/index.d.ts",
|
|
196
187
|
"import": {
|
|
@@ -200,15 +191,6 @@
|
|
|
200
191
|
"require": "./serialized-memo/index.cjs",
|
|
201
192
|
"default": "./serialized-memo/index.cjs"
|
|
202
193
|
},
|
|
203
|
-
"./tagged": {
|
|
204
|
-
"types": "./tagged/index.d.ts",
|
|
205
|
-
"import": {
|
|
206
|
-
"types": "./tagged/index.d.ts",
|
|
207
|
-
"default": "./tagged/index.mjs"
|
|
208
|
-
},
|
|
209
|
-
"require": "./tagged/index.cjs",
|
|
210
|
-
"default": "./tagged/index.cjs"
|
|
211
|
-
},
|
|
212
194
|
"./simple-string-hash": {
|
|
213
195
|
"types": "./simple-string-hash/index.d.ts",
|
|
214
196
|
"import": {
|
|
@@ -218,6 +200,15 @@
|
|
|
218
200
|
"require": "./simple-string-hash/index.cjs",
|
|
219
201
|
"default": "./simple-string-hash/index.cjs"
|
|
220
202
|
},
|
|
203
|
+
"./tagged": {
|
|
204
|
+
"types": "./tagged/index.d.ts",
|
|
205
|
+
"import": {
|
|
206
|
+
"types": "./tagged/index.d.ts",
|
|
207
|
+
"default": "./tagged/index.mjs"
|
|
208
|
+
},
|
|
209
|
+
"require": "./tagged/index.cjs",
|
|
210
|
+
"default": "./tagged/index.cjs"
|
|
211
|
+
},
|
|
221
212
|
"./wait": {
|
|
222
213
|
"types": "./wait/index.d.ts",
|
|
223
214
|
"import": {
|
|
@@ -226,6 +217,15 @@
|
|
|
226
217
|
},
|
|
227
218
|
"require": "./wait/index.cjs",
|
|
228
219
|
"default": "./wait/index.cjs"
|
|
220
|
+
},
|
|
221
|
+
"./guard": {
|
|
222
|
+
"types": "./guard/index.d.ts",
|
|
223
|
+
"import": {
|
|
224
|
+
"types": "./guard/index.d.ts",
|
|
225
|
+
"default": "./guard/index.mjs"
|
|
226
|
+
},
|
|
227
|
+
"require": "./guard/index.cjs",
|
|
228
|
+
"default": "./guard/index.cjs"
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
}
|
package/retrie/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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,8 +1,17 @@
|
|
|
1
|
+
import { Noop } from '../noop/index.js';
|
|
2
|
+
|
|
3
|
+
interface BaseTrie {
|
|
4
|
+
[key: string]: Trie;
|
|
5
|
+
}
|
|
6
|
+
type Trie = BaseTrie | {
|
|
7
|
+
'': '';
|
|
8
|
+
};
|
|
1
9
|
declare function retrie(keywords: ArrayLike<string>, asPrefixes?: boolean): {
|
|
10
|
+
tree: BaseTrie;
|
|
2
11
|
add: (keywords: string, asPrefixes: boolean) => void;
|
|
3
12
|
toString: () => string;
|
|
4
13
|
toRe: () => RegExp;
|
|
5
14
|
};
|
|
6
|
-
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);
|
|
7
16
|
|
|
8
17
|
export { createRetrieKeywordFilter, retrie };
|
package/retrie/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
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};
|