foxts 1.1.5 → 1.1.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.
@@ -1 +1 @@
1
- "use strict";exports.addArrayElementsToSet=function(r,t){return t.forEach(r.add,r),r};
1
+ "use strict";var e=require("../identity/index.cjs");exports.addArrayElementsToSet=function(t,r,i=e.identity){return r.forEach(e=>t.add(i(e))),t};
@@ -1,3 +1,3 @@
1
- declare function addArrayElementsToSet<T>(set: Set<T>, arr: T[]): Set<T>;
1
+ declare function addArrayElementsToSet<T>(set: Set<T>, arr: T[], transformer?: (item: T) => T): Set<T>;
2
2
 
3
3
  export { addArrayElementsToSet };
@@ -1 +1 @@
1
- function r(r,e){return e.forEach(r.add,r),r}export{r as addArrayElementsToSet};
1
+ import{identity as r}from"../identity/index.mjs";function t(e,d,n=r){return d.forEach(r=>e.add(n(r))),e}export{t as addArrayElementsToSet};
@@ -1 +1 @@
1
- "use strict";const e=/[$()*+.?[\\\]^{|}]/g;exports.escapeStringRegexp=function(r){return r.replaceAll(e,"\\$&").replaceAll("-","\\x2d")};
1
+ "use strict";const e=/[$()*+.?[\\\]^{|}-]/g,t={"\\":"\\\\","^":"\\^",$:"\\$",".":"\\.","*":"\\*","+":"\\+","?":"\\?","(":"\\(",")":"\\)","[":"\\[","]":"\\]","{":"\\{","}":"\\}","|":"\\|","-":"\\x2d"},r=e=>t[e];exports.escapeStringRegexp=function(t){return t.replaceAll(e,r)};
@@ -1 +1 @@
1
- const e=/[$()*+.?[\\\]^{|}]/g;function l(l){return l.replaceAll(e,"\\$&").replaceAll("-","\\x2d")}export{l as escapeStringRegexp};
1
+ const e=/[$()*+.?[\\\]^{|}-]/g,n={"\\":"\\\\","^":"\\^",$:"\\$",".":"\\.","*":"\\*","+":"\\+","?":"\\?","(":"\\(",")":"\\)","[":"\\[","]":"\\]","{":"\\{","}":"\\}","|":"\\|","-":"\\x2d"},r=e=>n[e];function t(n){return n.replaceAll(e,r)}export{t as escapeStringRegexp};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -56,14 +56,14 @@
56
56
  "require": "./async-write-to-stream/index.cjs",
57
57
  "default": "./async-write-to-stream/index.cjs"
58
58
  },
59
- "./escape-string-regexp": {
60
- "types": "./escape-string-regexp/index.d.ts",
59
+ "./bitwise": {
60
+ "types": "./bitwise/index.d.ts",
61
61
  "import": {
62
- "types": "./escape-string-regexp/index.d.ts",
63
- "default": "./escape-string-regexp/index.mjs"
62
+ "types": "./bitwise/index.d.ts",
63
+ "default": "./bitwise/index.mjs"
64
64
  },
65
- "require": "./escape-string-regexp/index.cjs",
66
- "default": "./escape-string-regexp/index.cjs"
65
+ "require": "./bitwise/index.cjs",
66
+ "default": "./bitwise/index.cjs"
67
67
  },
68
68
  "./ahocorasick": {
69
69
  "types": "./ahocorasick/index.d.ts",
@@ -74,6 +74,15 @@
74
74
  "require": "./ahocorasick/index.cjs",
75
75
  "default": "./ahocorasick/index.cjs"
76
76
  },
77
+ "./escape-string-regexp": {
78
+ "types": "./escape-string-regexp/index.d.ts",
79
+ "import": {
80
+ "types": "./escape-string-regexp/index.d.ts",
81
+ "default": "./escape-string-regexp/index.mjs"
82
+ },
83
+ "require": "./escape-string-regexp/index.cjs",
84
+ "default": "./escape-string-regexp/index.cjs"
85
+ },
77
86
  "./fast-string-array-join": {
78
87
  "types": "./fast-string-array-join/index.d.ts",
79
88
  "import": {
@@ -83,15 +92,6 @@
83
92
  "require": "./fast-string-array-join/index.cjs",
84
93
  "default": "./fast-string-array-join/index.cjs"
85
94
  },
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": {
@@ -137,15 +137,6 @@
137
137
  "require": "./headers-to-object/index.cjs",
138
138
  "default": "./headers-to-object/index.cjs"
139
139
  },
140
- "./identity": {
141
- "types": "./identity/index.d.ts",
142
- "import": {
143
- "types": "./identity/index.d.ts",
144
- "default": "./identity/index.mjs"
145
- },
146
- "require": "./identity/index.cjs",
147
- "default": "./identity/index.cjs"
148
- },
149
140
  "./is-probably-ip": {
150
141
  "types": "./is-probably-ip/index.d.ts",
151
142
  "import": {
@@ -155,6 +146,15 @@
155
146
  "require": "./is-probably-ip/index.cjs",
156
147
  "default": "./is-probably-ip/index.cjs"
157
148
  },
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": {
@@ -164,14 +164,14 @@
164
164
  "require": "./merge-headers/index.cjs",
165
165
  "default": "./merge-headers/index.cjs"
166
166
  },
167
- "./once": {
168
- "types": "./once/index.d.ts",
167
+ "./noop": {
168
+ "types": "./noop/index.d.ts",
169
169
  "import": {
170
- "types": "./once/index.d.ts",
171
- "default": "./once/index.mjs"
170
+ "types": "./noop/index.d.ts",
171
+ "default": "./noop/index.mjs"
172
172
  },
173
- "require": "./once/index.cjs",
174
- "default": "./once/index.cjs"
173
+ "require": "./noop/index.cjs",
174
+ "default": "./noop/index.cjs"
175
175
  },
176
176
  "./repool": {
177
177
  "types": "./repool/index.d.ts",
@@ -182,23 +182,14 @@
182
182
  "require": "./repool/index.cjs",
183
183
  "default": "./repool/index.cjs"
184
184
  },
185
- "./retrie": {
186
- "types": "./retrie/index.d.ts",
187
- "import": {
188
- "types": "./retrie/index.d.ts",
189
- "default": "./retrie/index.mjs"
190
- },
191
- "require": "./retrie/index.cjs",
192
- "default": "./retrie/index.cjs"
193
- },
194
- "./noop": {
195
- "types": "./noop/index.d.ts",
185
+ "./once": {
186
+ "types": "./once/index.d.ts",
196
187
  "import": {
197
- "types": "./noop/index.d.ts",
198
- "default": "./noop/index.mjs"
188
+ "types": "./once/index.d.ts",
189
+ "default": "./once/index.mjs"
199
190
  },
200
- "require": "./noop/index.cjs",
201
- "default": "./noop/index.cjs"
191
+ "require": "./once/index.cjs",
192
+ "default": "./once/index.cjs"
202
193
  },
203
194
  "./serialized-memo": {
204
195
  "types": "./serialized-memo/index.d.ts",
@@ -209,6 +200,15 @@
209
200
  "require": "./serialized-memo/index.cjs",
210
201
  "default": "./serialized-memo/index.cjs"
211
202
  },
203
+ "./retrie": {
204
+ "types": "./retrie/index.d.ts",
205
+ "import": {
206
+ "types": "./retrie/index.d.ts",
207
+ "default": "./retrie/index.mjs"
208
+ },
209
+ "require": "./retrie/index.cjs",
210
+ "default": "./retrie/index.cjs"
211
+ },
212
212
  "./simple-string-hash": {
213
213
  "types": "./simple-string-hash/index.d.ts",
214
214
  "import": {
package/wait/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";exports.wait=function(t){return new Promise(e=>{setTimeout(e,t)})};
1
+ "use strict";exports.wait=function(e){return new Promise(t=>{setTimeout(t,e)})},exports.waitWithAbort=function(e,t){return new Promise((r,n)=>{if(t.aborted){n(t.reason);return}const o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);function i(){clearTimeout(o),t.removeEventListener("abort",i),n(t.reason)}t.addEventListener("abort",i)})};
package/wait/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  declare function wait(ms: number): Promise<void>;
2
+ declare function waitWithAbort(ms: number, signal: AbortSignal): Promise<void>;
2
3
 
3
- export { wait };
4
+ export { wait, waitWithAbort };
package/wait/index.mjs CHANGED
@@ -1 +1 @@
1
- function e(e){return new Promise(t=>{setTimeout(t,e)})}export{e as wait};
1
+ function e(e){return new Promise(t=>{setTimeout(t,e)})}function t(e,t){return new Promise((r,n)=>{if(t.aborted){n(t.reason);return}const o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);function i(){clearTimeout(o),t.removeEventListener("abort",i),n(t.reason)}t.addEventListener("abort",i)})}export{e as wait,t as waitWithAbort};