foxts 1.1.7 → 1.2.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.
@@ -0,0 +1 @@
1
+ "use strict";const e=new Map;function t(e){return Array.from(Array(e).keys())}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function a(e){let r,a;return n.has(e)&&(a=(r=n.get(e)).deref()),a||(r=new WeakRef(a=t(e)),n.set(e,r)),a}const o="function"==typeof WeakRef?a:r;exports.createFixedArray=o,exports.createFixedArrayWithGC=a,exports.createFixedArrayWithoutGC=r;
@@ -0,0 +1,5 @@
1
+ declare function createFixedArrayWithoutGC(length: number): readonly number[];
2
+ declare function createFixedArrayWithGC(length: number): readonly number[];
3
+ declare const createFixedArray: typeof createFixedArrayWithGC;
4
+
5
+ export { createFixedArray, createFixedArrayWithGC, createFixedArrayWithoutGC };
@@ -0,0 +1 @@
1
+ const e=new Map;function t(e){return Array.from(Array(e).keys())}function r(r){if(e.has(r))return e.get(r);const n=t(r);return e.set(r,n),n}const n=new Map;function a(e){let r,a;return n.has(e)&&(a=(r=n.get(e)).deref()),a||(r=new WeakRef(a=t(e)),n.set(e,r)),a}const o="function"==typeof WeakRef?a:r;export{o as createFixedArray,a as createFixedArrayWithGC,r as createFixedArrayWithoutGC};
@@ -1 +1 @@
1
- "use strict";exports.isProbablyIpv4=function(t){if(t.length<7||t.length>15)return!1;let e=0;for(let r=0;r<t.length;r+=1){const n=t.charCodeAt(r);if(46===n)e+=1;else if(n<48||n>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(t.length-1)},exports.isProbablyIpv6=function(t){if(t.length<3)return!1;let e="["===t[0]?1:0,r=t.length;if("]"===t[r-1]&&(r-=1),r-e>39)return!1;let n=!1;for(;e<r;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};
1
+ "use strict";exports.isProbablyIpv4=function(t){if(t.length<7||t.length>15)return!1;let e=0;for(let r=0;r<t.length;r+=1){const n=t.charCodeAt(r);if(46===n)e+=1;else if(n<48||n>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(t.length-1)},exports.isProbablyIpv6=function(t){if(t.length<3)return!1;let e=+("["===t[0]),r=t.length;if("]"===t[r-1]&&(r-=1),r-e>39)return!1;let n=!1;for(;e<r;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};
@@ -1 +1 @@
1
- function e(e){if(e.length<7||e.length>15)return!1;let t=0;for(let r=0;r<e.length;r+=1){const n=e.charCodeAt(r);if(46===n)t+=1;else if(n<48||n>57)return!1}return 3===t&&46!==e.charCodeAt(0)&&46!==e.charCodeAt(e.length-1)}function t(e){if(e.length<3)return!1;let t="["===e[0]?1:0,r=e.length;if("]"===e[r-1]&&(r-=1),r-t>39)return!1;let n=!1;for(;t<r;t+=1){const r=e.charCodeAt(t);if(58===r)n=!0;else if(!(r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=90))return!1}return n}export{e as isProbablyIpv4,t as isProbablyIpv6};
1
+ function e(e){if(e.length<7||e.length>15)return!1;let t=0;for(let r=0;r<e.length;r+=1){const n=e.charCodeAt(r);if(46===n)t+=1;else if(n<48||n>57)return!1}return 3===t&&46!==e.charCodeAt(0)&&46!==e.charCodeAt(e.length-1)}function t(e){if(e.length<3)return!1;let t=+("["===e[0]),r=e.length;if("]"===e[r-1]&&(r-=1),r-t>39)return!1;let n=!1;for(;t<r;t+=1){const r=e.charCodeAt(t);if(58===r)n=!0;else if(!(r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=90))return!1}return n}export{e as isProbablyIpv4,t as isProbablyIpv6};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -47,15 +47,6 @@
47
47
  "require": "./append-set-elements-to-array/index.cjs",
48
48
  "default": "./append-set-elements-to-array/index.cjs"
49
49
  },
50
- "./async-write-to-stream": {
51
- "types": "./async-write-to-stream/index.d.ts",
52
- "import": {
53
- "types": "./async-write-to-stream/index.d.ts",
54
- "default": "./async-write-to-stream/index.mjs"
55
- },
56
- "require": "./async-write-to-stream/index.cjs",
57
- "default": "./async-write-to-stream/index.cjs"
58
- },
59
50
  "./bitwise": {
60
51
  "types": "./bitwise/index.d.ts",
61
52
  "import": {
@@ -74,6 +65,15 @@
74
65
  "require": "./ahocorasick/index.cjs",
75
66
  "default": "./ahocorasick/index.cjs"
76
67
  },
68
+ "./create-fixed-array": {
69
+ "types": "./create-fixed-array/index.d.ts",
70
+ "import": {
71
+ "types": "./create-fixed-array/index.d.ts",
72
+ "default": "./create-fixed-array/index.mjs"
73
+ },
74
+ "require": "./create-fixed-array/index.cjs",
75
+ "default": "./create-fixed-array/index.cjs"
76
+ },
77
77
  "./escape-string-regexp": {
78
78
  "types": "./escape-string-regexp/index.d.ts",
79
79
  "import": {
@@ -83,6 +83,15 @@
83
83
  "require": "./escape-string-regexp/index.cjs",
84
84
  "default": "./escape-string-regexp/index.cjs"
85
85
  },
86
+ "./async-write-to-stream": {
87
+ "types": "./async-write-to-stream/index.d.ts",
88
+ "import": {
89
+ "types": "./async-write-to-stream/index.d.ts",
90
+ "default": "./async-write-to-stream/index.mjs"
91
+ },
92
+ "require": "./async-write-to-stream/index.cjs",
93
+ "default": "./async-write-to-stream/index.cjs"
94
+ },
86
95
  "./fast-string-array-join": {
87
96
  "types": "./fast-string-array-join/index.d.ts",
88
97
  "import": {
@@ -110,14 +119,14 @@
110
119
  "require": "./fnv1a/index.cjs",
111
120
  "default": "./fnv1a/index.cjs"
112
121
  },
113
- "./fnv1a52": {
114
- "types": "./fnv1a52/index.d.ts",
122
+ "./headers-to-object": {
123
+ "types": "./headers-to-object/index.d.ts",
115
124
  "import": {
116
- "types": "./fnv1a52/index.d.ts",
117
- "default": "./fnv1a52/index.mjs"
125
+ "types": "./headers-to-object/index.d.ts",
126
+ "default": "./headers-to-object/index.mjs"
118
127
  },
119
- "require": "./fnv1a52/index.cjs",
120
- "default": "./fnv1a52/index.cjs"
128
+ "require": "./headers-to-object/index.cjs",
129
+ "default": "./headers-to-object/index.cjs"
121
130
  },
122
131
  "./guard": {
123
132
  "types": "./guard/index.d.ts",
@@ -128,14 +137,14 @@
128
137
  "require": "./guard/index.cjs",
129
138
  "default": "./guard/index.cjs"
130
139
  },
131
- "./headers-to-object": {
132
- "types": "./headers-to-object/index.d.ts",
140
+ "./identity": {
141
+ "types": "./identity/index.d.ts",
133
142
  "import": {
134
- "types": "./headers-to-object/index.d.ts",
135
- "default": "./headers-to-object/index.mjs"
143
+ "types": "./identity/index.d.ts",
144
+ "default": "./identity/index.mjs"
136
145
  },
137
- "require": "./headers-to-object/index.cjs",
138
- "default": "./headers-to-object/index.cjs"
146
+ "require": "./identity/index.cjs",
147
+ "default": "./identity/index.cjs"
139
148
  },
140
149
  "./is-probably-ip": {
141
150
  "types": "./is-probably-ip/index.d.ts",
@@ -146,15 +155,6 @@
146
155
  "require": "./is-probably-ip/index.cjs",
147
156
  "default": "./is-probably-ip/index.cjs"
148
157
  },
149
- "./identity": {
150
- "types": "./identity/index.d.ts",
151
- "import": {
152
- "types": "./identity/index.d.ts",
153
- "default": "./identity/index.mjs"
154
- },
155
- "require": "./identity/index.cjs",
156
- "default": "./identity/index.cjs"
157
- },
158
158
  "./merge-headers": {
159
159
  "types": "./merge-headers/index.d.ts",
160
160
  "import": {
@@ -173,15 +173,6 @@
173
173
  "require": "./noop/index.cjs",
174
174
  "default": "./noop/index.cjs"
175
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
- },
185
176
  "./once": {
186
177
  "types": "./once/index.d.ts",
187
178
  "import": {
@@ -191,14 +182,23 @@
191
182
  "require": "./once/index.cjs",
192
183
  "default": "./once/index.cjs"
193
184
  },
194
- "./serialized-memo": {
195
- "types": "./serialized-memo/index.d.ts",
185
+ "./fnv1a52": {
186
+ "types": "./fnv1a52/index.d.ts",
196
187
  "import": {
197
- "types": "./serialized-memo/index.d.ts",
198
- "default": "./serialized-memo/index.mjs"
188
+ "types": "./fnv1a52/index.d.ts",
189
+ "default": "./fnv1a52/index.mjs"
199
190
  },
200
- "require": "./serialized-memo/index.cjs",
201
- "default": "./serialized-memo/index.cjs"
191
+ "require": "./fnv1a52/index.cjs",
192
+ "default": "./fnv1a52/index.cjs"
193
+ },
194
+ "./repool": {
195
+ "types": "./repool/index.d.ts",
196
+ "import": {
197
+ "types": "./repool/index.d.ts",
198
+ "default": "./repool/index.mjs"
199
+ },
200
+ "require": "./repool/index.cjs",
201
+ "default": "./repool/index.cjs"
202
202
  },
203
203
  "./retrie": {
204
204
  "types": "./retrie/index.d.ts",
@@ -209,14 +209,14 @@
209
209
  "require": "./retrie/index.cjs",
210
210
  "default": "./retrie/index.cjs"
211
211
  },
212
- "./simple-string-hash": {
213
- "types": "./simple-string-hash/index.d.ts",
212
+ "./serialized-memo": {
213
+ "types": "./serialized-memo/index.d.ts",
214
214
  "import": {
215
- "types": "./simple-string-hash/index.d.ts",
216
- "default": "./simple-string-hash/index.mjs"
215
+ "types": "./serialized-memo/index.d.ts",
216
+ "default": "./serialized-memo/index.mjs"
217
217
  },
218
- "require": "./simple-string-hash/index.cjs",
219
- "default": "./simple-string-hash/index.cjs"
218
+ "require": "./serialized-memo/index.cjs",
219
+ "default": "./serialized-memo/index.cjs"
220
220
  },
221
221
  "./tagged": {
222
222
  "types": "./tagged/index.d.ts",
@@ -227,6 +227,15 @@
227
227
  "require": "./tagged/index.cjs",
228
228
  "default": "./tagged/index.cjs"
229
229
  },
230
+ "./simple-string-hash": {
231
+ "types": "./simple-string-hash/index.d.ts",
232
+ "import": {
233
+ "types": "./simple-string-hash/index.d.ts",
234
+ "default": "./simple-string-hash/index.mjs"
235
+ },
236
+ "require": "./simple-string-hash/index.cjs",
237
+ "default": "./simple-string-hash/index.cjs"
238
+ },
230
239
  "./wait": {
231
240
  "types": "./wait/index.d.ts",
232
241
  "import": {