foxts 1.0.6 → 1.0.7
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/add-array-elements-to-set/index.cjs +1 -0
- package/add-array-elements-to-set/index.d.ts +3 -0
- package/add-array-elements-to-set/index.mjs +1 -0
- package/ahocorasick/index.cjs +1 -0
- package/ahocorasick/index.d.ts +3 -0
- package/ahocorasick/index.mjs +1 -0
- package/fifo/index.cjs +1 -0
- package/fifo/index.d.ts +14 -0
- package/fifo/index.mjs +1 -0
- package/package.json +64 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.addArrayElementsToSet=function(r,t){return t.forEach(r.add,r),r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,e){return e.forEach(r.add,r),r}export{r as addArrayElementsToSet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class t extends Map{wordEnd;fail;constructor(t,e){super(),this.wordEnd=t,this.fail=e}}exports.createAhoCorasick=function(e){const o=new t(!1,void 0);e.forEach(e=>{let r=o;for(let o=0,s=e.length;o<s;o++){const s=e[o];if(r.has(s))r=r.get(s);else{const e=new t(!1,void 0);r.set(s,e),r=e}}r!==o&&(r.wordEnd=!0)});const r=[o];for(;r.length;){const t=r.pop();t.forEach((e,s)=>{let n=t.fail;for(;n&&!n.has(s);)n=n.fail;e.fail=n?n.get(s):o,r.push(e)})}return t=>{let e=o;for(let r=0,s=t.length;r<s;r++){const s=t[r];for(;e&&!e.has(s);)e=e.fail;if((e=e?e.get(s):o).wordEnd)return!0}return!1}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t extends Map{wordEnd;fail;constructor(t,o){super(),this.wordEnd=t,this.fail=o}}function o(o){const e=new t(!1,void 0);o.forEach(o=>{let r=e;for(let e=0,n=o.length;e<n;e++){const n=o[e];if(r.has(n))r=r.get(n);else{const o=new t(!1,void 0);r.set(n,o),r=o}}r!==e&&(r.wordEnd=!0)});const r=[e];for(;r.length;){const t=r.pop();t.forEach((o,n)=>{let s=t.fail;for(;s&&!s.has(n);)s=s.fail;o.fail=s?s.get(n):e,r.push(o)})}return t=>{let o=e;for(let r=0,n=t.length;r<n;r++){const n=t[r];for(;o&&!o.has(n);)o=o.fail;if((o=o?o.get(n):e).wordEnd)return!0}return!1}}export{o as createAhoCorasick};
|
package/fifo/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e;e=Symbol.iterator,exports.FIFO=class{head=null;tail=null;$size=0;constructor(){this.clear()}enqueue(e){const t=[e,null];this.head?this.tail[1]=t:this.head=t,this.tail=t,this.$size++}dequeue(){const e=this.head;if(e)return this.head=this.head[1],this.$size--,e[0]}peek(){return this.head?.[0]}clear(){this.head=null,this.tail=null,this.$size=0}get size(){return this.$size}*[e](){let e=this.head;for(;e;)yield e[0],e=e[1]}};
|
package/fifo/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class FIFO<T> {
|
|
2
|
+
private head;
|
|
3
|
+
private tail;
|
|
4
|
+
$size: number;
|
|
5
|
+
constructor();
|
|
6
|
+
enqueue(value: T): void;
|
|
7
|
+
dequeue(): T | undefined;
|
|
8
|
+
peek(): T | undefined;
|
|
9
|
+
clear(): void;
|
|
10
|
+
get size(): number;
|
|
11
|
+
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { FIFO };
|
package/fifo/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;e=Symbol.iterator;class t{head=null;tail=null;$size=0;constructor(){this.clear()}enqueue(e){const t=[e,null];this.head?this.tail[1]=t:this.head=t,this.tail=t,this.$size++}dequeue(){const e=this.head;if(e)return this.head=this.head[1],this.$size--,e[0]}peek(){return this.head?.[0]}clear(){this.head=null,this.tail=null,this.$size=0}get size(){return this.$size}*[e](){let e=this.head;for(;e;)yield e[0],e=e[1]}}export{t as FIFO};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -29,6 +29,24 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
"./package.json": "./package.json",
|
|
31
31
|
"./sizes.json": "./sizes.json",
|
|
32
|
+
"./add-array-elements-to-set": {
|
|
33
|
+
"types": "./add-array-elements-to-set/index.d.ts",
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./add-array-elements-to-set/index.d.ts",
|
|
36
|
+
"default": "./add-array-elements-to-set/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"require": "./add-array-elements-to-set/index.cjs",
|
|
39
|
+
"default": "./add-array-elements-to-set/index.cjs"
|
|
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
|
+
},
|
|
32
50
|
"./append-set-elements-to-array": {
|
|
33
51
|
"types": "./append-set-elements-to-array/index.d.ts",
|
|
34
52
|
"import": {
|
|
@@ -38,15 +56,6 @@
|
|
|
38
56
|
"require": "./append-set-elements-to-array/index.cjs",
|
|
39
57
|
"default": "./append-set-elements-to-array/index.cjs"
|
|
40
58
|
},
|
|
41
|
-
"./async-write-to-stream": {
|
|
42
|
-
"types": "./async-write-to-stream/index.d.ts",
|
|
43
|
-
"import": {
|
|
44
|
-
"types": "./async-write-to-stream/index.d.ts",
|
|
45
|
-
"default": "./async-write-to-stream/index.mjs"
|
|
46
|
-
},
|
|
47
|
-
"require": "./async-write-to-stream/index.cjs",
|
|
48
|
-
"default": "./async-write-to-stream/index.cjs"
|
|
49
|
-
},
|
|
50
59
|
"./fast-string-array-join": {
|
|
51
60
|
"types": "./fast-string-array-join/index.d.ts",
|
|
52
61
|
"import": {
|
|
@@ -56,14 +65,23 @@
|
|
|
56
65
|
"require": "./fast-string-array-join/index.cjs",
|
|
57
66
|
"default": "./fast-string-array-join/index.cjs"
|
|
58
67
|
},
|
|
59
|
-
"./
|
|
60
|
-
"types": "./
|
|
68
|
+
"./fifo": {
|
|
69
|
+
"types": "./fifo/index.d.ts",
|
|
61
70
|
"import": {
|
|
62
|
-
"types": "./
|
|
63
|
-
"default": "./
|
|
71
|
+
"types": "./fifo/index.d.ts",
|
|
72
|
+
"default": "./fifo/index.mjs"
|
|
64
73
|
},
|
|
65
|
-
"require": "./
|
|
66
|
-
"default": "./
|
|
74
|
+
"require": "./fifo/index.cjs",
|
|
75
|
+
"default": "./fifo/index.cjs"
|
|
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"
|
|
67
85
|
},
|
|
68
86
|
"./bitwise": {
|
|
69
87
|
"types": "./bitwise/index.d.ts",
|
|
@@ -74,14 +92,23 @@
|
|
|
74
92
|
"require": "./bitwise/index.cjs",
|
|
75
93
|
"default": "./bitwise/index.cjs"
|
|
76
94
|
},
|
|
77
|
-
"./
|
|
78
|
-
"types": "./
|
|
95
|
+
"./fnv1a": {
|
|
96
|
+
"types": "./fnv1a/index.d.ts",
|
|
79
97
|
"import": {
|
|
80
|
-
"types": "./
|
|
81
|
-
"default": "./
|
|
98
|
+
"types": "./fnv1a/index.d.ts",
|
|
99
|
+
"default": "./fnv1a/index.mjs"
|
|
82
100
|
},
|
|
83
|
-
"require": "./
|
|
84
|
-
"default": "./
|
|
101
|
+
"require": "./fnv1a/index.cjs",
|
|
102
|
+
"default": "./fnv1a/index.cjs"
|
|
103
|
+
},
|
|
104
|
+
"./headers-to-object": {
|
|
105
|
+
"types": "./headers-to-object/index.d.ts",
|
|
106
|
+
"import": {
|
|
107
|
+
"types": "./headers-to-object/index.d.ts",
|
|
108
|
+
"default": "./headers-to-object/index.mjs"
|
|
109
|
+
},
|
|
110
|
+
"require": "./headers-to-object/index.cjs",
|
|
111
|
+
"default": "./headers-to-object/index.cjs"
|
|
85
112
|
},
|
|
86
113
|
"./guard": {
|
|
87
114
|
"types": "./guard/index.d.ts",
|
|
@@ -92,14 +119,14 @@
|
|
|
92
119
|
"require": "./guard/index.cjs",
|
|
93
120
|
"default": "./guard/index.cjs"
|
|
94
121
|
},
|
|
95
|
-
"./
|
|
96
|
-
"types": "./
|
|
122
|
+
"./fnv1a52": {
|
|
123
|
+
"types": "./fnv1a52/index.d.ts",
|
|
97
124
|
"import": {
|
|
98
|
-
"types": "./
|
|
99
|
-
"default": "./
|
|
125
|
+
"types": "./fnv1a52/index.d.ts",
|
|
126
|
+
"default": "./fnv1a52/index.mjs"
|
|
100
127
|
},
|
|
101
|
-
"require": "./
|
|
102
|
-
"default": "./
|
|
128
|
+
"require": "./fnv1a52/index.cjs",
|
|
129
|
+
"default": "./fnv1a52/index.cjs"
|
|
103
130
|
},
|
|
104
131
|
"./identity": {
|
|
105
132
|
"types": "./identity/index.d.ts",
|
|
@@ -110,15 +137,6 @@
|
|
|
110
137
|
"require": "./identity/index.cjs",
|
|
111
138
|
"default": "./identity/index.cjs"
|
|
112
139
|
},
|
|
113
|
-
"./is-probably-ip": {
|
|
114
|
-
"types": "./is-probably-ip/index.d.ts",
|
|
115
|
-
"import": {
|
|
116
|
-
"types": "./is-probably-ip/index.d.ts",
|
|
117
|
-
"default": "./is-probably-ip/index.mjs"
|
|
118
|
-
},
|
|
119
|
-
"require": "./is-probably-ip/index.cjs",
|
|
120
|
-
"default": "./is-probably-ip/index.cjs"
|
|
121
|
-
},
|
|
122
140
|
"./merge-headers": {
|
|
123
141
|
"types": "./merge-headers/index.d.ts",
|
|
124
142
|
"import": {
|
|
@@ -128,6 +146,15 @@
|
|
|
128
146
|
"require": "./merge-headers/index.cjs",
|
|
129
147
|
"default": "./merge-headers/index.cjs"
|
|
130
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
|
+
},
|
|
131
158
|
"./noop": {
|
|
132
159
|
"types": "./noop/index.d.ts",
|
|
133
160
|
"import": {
|