@vielzeug/arsenal 26.11.11 → 26.11.13
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/dist/arsenal.cjs +1 -1
- package/dist/arsenal.cjs.map +1 -1
- package/dist/arsenal.iife.js +1 -1
- package/dist/arsenal.iife.js.map +1 -1
- package/dist/arsenal.js +18 -1
- package/dist/arsenal.js.map +1 -1
- package/dist/async/index.cjs +1 -1
- package/dist/async/index.d.ts +1 -0
- package/dist/async/index.d.ts.map +1 -1
- package/dist/async/index.js +3 -2
- package/dist/async/timer.cjs +2 -0
- package/dist/async/timer.cjs.map +1 -0
- package/dist/async/timer.d.ts +25 -0
- package/dist/async/timer.d.ts.map +1 -0
- package/dist/async/timer.js +20 -0
- package/dist/async/timer.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -28
- package/package.json +1 -1
package/dist/arsenal.js
CHANGED
|
@@ -276,6 +276,23 @@ function taskPool({ concurrency: e = 1 } = {}) {
|
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
+
// src/async/timer.ts
|
|
280
|
+
function timer(e) {
|
|
281
|
+
let t, cancel = () => {
|
|
282
|
+
t !== void 0 && (clearTimeout(t), t = void 0);
|
|
283
|
+
};
|
|
284
|
+
return {
|
|
285
|
+
arm(n) {
|
|
286
|
+
cancel(), t = setTimeout(() => {
|
|
287
|
+
t = void 0, e();
|
|
288
|
+
}, n);
|
|
289
|
+
},
|
|
290
|
+
cancel,
|
|
291
|
+
get pending() {
|
|
292
|
+
return t !== void 0;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
279
296
|
// src/async/waitFor.ts
|
|
280
297
|
async function waitFor(e, { interval: t = 100, signal: n, timeout: r = 5e3 } = {}) {
|
|
281
298
|
let i = AbortSignal.timeout(r), a = n ? AbortSignal.any([n, i]) : i;
|
|
@@ -764,6 +781,6 @@ function normalizeCase(e, t = " ") {
|
|
|
764
781
|
function camelCase(e) {
|
|
765
782
|
return normalizeCase(e, " ").replace(/[^\p{L}\p{N}]+(.)/gu, (e, t) => t.toUpperCase()).replace(/^./, (e) => e.toLowerCase());
|
|
766
783
|
}
|
|
767
|
-
export { ArsenalError, ArsenalSerializationError, ShareCodeError, abortError, abortable, allOf, allocate, anyOf, attempt, backoff, base64UrlToBytes, base64UrlToText, bytesToBase64Url, cache, camelCase, chunk, clamp, compressBytes, debounce, decompressBytes, filterMap, getPath, getPathOr, groupBy, hash, indexBy, isDefined, isEqual, isFail, isNil, isOk, isPlainObject, memo, noneOf, not, omit, once, pack, paginate, parallel, partition, pick, pipe, random, randomFloat, range, requirePath, retry, sleep, sort, tapper, taskPool, textToBase64Url, throttle, uniq, unpack, utf8Bytes, waitFor };
|
|
784
|
+
export { ArsenalError, ArsenalSerializationError, ShareCodeError, abortError, abortable, allOf, allocate, anyOf, attempt, backoff, base64UrlToBytes, base64UrlToText, bytesToBase64Url, cache, camelCase, chunk, clamp, compressBytes, debounce, decompressBytes, filterMap, getPath, getPathOr, groupBy, hash, indexBy, isDefined, isEqual, isFail, isNil, isOk, isPlainObject, memo, noneOf, not, omit, once, pack, paginate, parallel, partition, pick, pipe, random, randomFloat, range, requirePath, retry, sleep, sort, tapper, taskPool, textToBase64Url, throttle, timer, uniq, unpack, utf8Bytes, waitFor };
|
|
768
785
|
|
|
769
786
|
//# sourceMappingURL=arsenal.js.map
|