umt 2.16.0 → 2.18.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.
- package/README.md +344 -308
- package/module/Array/chunk.js.map +1 -1
- package/module/Array/uniqBy.js.map +1 -1
- package/module/Async/debounceAsync.d.ts +18 -0
- package/module/Async/debounceAsync.js +59 -0
- package/module/Async/debounceAsync.js.map +1 -0
- package/module/Async/index.d.ts +5 -0
- package/module/Async/index.js +5 -0
- package/module/Async/index.js.map +1 -1
- package/module/Async/pSettled.d.ts +19 -0
- package/module/Async/pSettled.js +54 -0
- package/module/Async/pSettled.js.map +1 -0
- package/module/Async/retry.d.ts +22 -0
- package/module/Async/retry.js +49 -0
- package/module/Async/retry.js.map +1 -0
- package/module/Async/throttleAsync.d.ts +18 -0
- package/module/Async/throttleAsync.js +41 -0
- package/module/Async/throttleAsync.js.map +1 -0
- package/module/Async/waitFor.d.ts +18 -0
- package/module/Async/waitFor.js +32 -0
- package/module/Async/waitFor.js.map +1 -0
- package/module/Date/addDuration.d.ts +15 -0
- package/module/Date/addDuration.js +40 -0
- package/module/Date/addDuration.js.map +1 -0
- package/module/Date/diff.d.ts +14 -0
- package/module/Date/diff.js +45 -0
- package/module/Date/diff.js.map +1 -0
- package/module/Date/durationUnit.d.ts +12 -0
- package/module/Date/durationUnit.js +2 -0
- package/module/Date/durationUnit.js.map +1 -0
- package/module/Date/endOf.d.ts +13 -0
- package/module/Date/endOf.js +58 -0
- package/module/Date/endOf.js.map +1 -0
- package/module/Date/formatRelative.d.ts +13 -0
- package/module/Date/formatRelative.js +35 -0
- package/module/Date/formatRelative.js.map +1 -0
- package/module/Date/index.d.ts +10 -0
- package/module/Date/index.js +10 -0
- package/module/Date/index.js.map +1 -1
- package/module/Date/isBusinessDay.d.ts +10 -0
- package/module/Date/isBusinessDay.js +18 -0
- package/module/Date/isBusinessDay.js.map +1 -0
- package/module/Date/isSameDay.d.ts +10 -0
- package/module/Date/isSameDay.js +13 -0
- package/module/Date/isSameDay.js.map +1 -0
- package/module/Date/isWeekend.d.ts +9 -0
- package/module/Date/isWeekend.js +13 -0
- package/module/Date/isWeekend.js.map +1 -0
- package/module/Date/msByUnit.d.ts +2 -0
- package/module/Date/msByUnit.js +10 -0
- package/module/Date/msByUnit.js.map +1 -0
- package/module/Date/startOf.d.ts +13 -0
- package/module/Date/startOf.js +58 -0
- package/module/Date/startOf.js.map +1 -0
- package/module/Date/subDuration.d.ts +13 -0
- package/module/Date/subDuration.js +14 -0
- package/module/Date/subDuration.js.map +1 -0
- package/module/Error/index.d.ts +0 -1
- package/module/Error/index.js +0 -1
- package/module/Error/index.js.map +1 -1
- package/module/Object/deepClone.js.map +1 -1
- package/module/Object/flattenObject.d.ts +11 -0
- package/module/Object/flattenObject.js +29 -0
- package/module/Object/flattenObject.js.map +1 -0
- package/module/Object/get.d.ts +1 -0
- package/module/Object/get.js +26 -0
- package/module/Object/get.js.map +1 -0
- package/module/Object/has.d.ts +0 -19
- package/module/Object/has.js +4 -4
- package/module/Object/has.js.map +1 -1
- package/module/Object/index.d.ts +8 -0
- package/module/Object/index.js +8 -0
- package/module/Object/index.js.map +1 -1
- package/module/Object/invert.d.ts +12 -0
- package/module/Object/invert.js +20 -0
- package/module/Object/invert.js.map +1 -0
- package/module/Object/mergeDeep.js.map +1 -1
- package/module/Object/omitBy.d.ts +11 -0
- package/module/Object/omitBy.js +21 -0
- package/module/Object/omitBy.js.map +1 -0
- package/module/Object/pathSegments.d.ts +1 -0
- package/module/Object/pathSegments.js +2 -0
- package/module/Object/pathSegments.js.map +1 -0
- package/module/Object/pickBy.d.ts +11 -0
- package/module/Object/pickBy.js +21 -0
- package/module/Object/pickBy.js.map +1 -0
- package/module/Object/set.d.ts +19 -0
- package/module/Object/set.js +38 -0
- package/module/Object/set.js.map +1 -0
- package/module/Object/unflattenObject.d.ts +15 -0
- package/module/Object/unflattenObject.js +23 -0
- package/module/Object/unflattenObject.js.map +1 -0
- package/module/Random/index.d.ts +7 -0
- package/module/Random/index.js +8 -0
- package/module/Random/index.js.map +1 -0
- package/module/Random/randomBoolean.d.ts +9 -0
- package/module/Random/randomBoolean.js +10 -0
- package/module/Random/randomBoolean.js.map +1 -0
- package/module/Random/randomChoice.d.ts +9 -0
- package/module/Random/randomChoice.js +13 -0
- package/module/Random/randomChoice.js.map +1 -0
- package/module/Random/randomFloat.d.ts +9 -0
- package/module/Random/randomFloat.js +10 -0
- package/module/Random/randomFloat.js.map +1 -0
- package/module/Random/randomInt.d.ts +9 -0
- package/module/Random/randomInt.js +14 -0
- package/module/Random/randomInt.js.map +1 -0
- package/module/Random/randomUuid.d.ts +9 -0
- package/module/Random/randomUuid.js +31 -0
- package/module/Random/randomUuid.js.map +1 -0
- package/module/Random/seededRandom.d.ts +11 -0
- package/module/Random/seededRandom.js +31 -0
- package/module/Random/seededRandom.js.map +1 -0
- package/module/Random/weightedChoice.d.ts +15 -0
- package/module/Random/weightedChoice.js +34 -0
- package/module/Random/weightedChoice.js.map +1 -0
- package/module/String/capitalize.d.ts +12 -0
- package/module/String/capitalize.js +18 -0
- package/module/String/capitalize.js.map +1 -0
- package/module/String/capitalizeWord.d.ts +1 -0
- package/module/String/capitalizeWord.js +2 -0
- package/module/String/capitalizeWord.js.map +1 -0
- package/module/String/dedent.d.ts +19 -0
- package/module/String/dedent.js +56 -0
- package/module/String/dedent.js.map +1 -0
- package/module/String/index.d.ts +10 -0
- package/module/String/index.js +10 -0
- package/module/String/index.js.map +1 -1
- package/module/String/mask.d.ts +20 -0
- package/module/String/mask.js +24 -0
- package/module/String/mask.js.map +1 -0
- package/module/String/pascalCase.d.ts +9 -0
- package/module/String/pascalCase.js +14 -0
- package/module/String/pascalCase.js.map +1 -0
- package/module/String/snakeCase.d.ts +9 -0
- package/module/String/snakeCase.js +13 -0
- package/module/String/snakeCase.js.map +1 -0
- package/module/String/titleCase.d.ts +9 -0
- package/module/String/titleCase.js +14 -0
- package/module/String/titleCase.js.map +1 -0
- package/module/String/uncapitalize.d.ts +10 -0
- package/module/String/uncapitalize.js +16 -0
- package/module/String/uncapitalize.js.map +1 -0
- package/module/String/wordCount.d.ts +10 -0
- package/module/String/wordCount.js +12 -0
- package/module/String/wordCount.js.map +1 -0
- package/module/String/words.d.ts +12 -0
- package/module/String/words.js +21 -0
- package/module/String/words.js.map +1 -0
- package/module/Tool/createPipeline.d.ts +1 -1
- package/module/Tool/createPipeline.js +8 -6
- package/module/Tool/createPipeline.js.map +1 -1
- package/module/Tool/pipe.js.map +1 -1
- package/module/URL/buildUrl.d.ts +10 -0
- package/module/URL/buildUrl.js +10 -4
- package/module/URL/buildUrl.js.map +1 -1
- package/module/URL/parseQueryString.d.ts +6 -0
- package/module/URL/parseQueryString.js +6 -4
- package/module/URL/parseQueryString.js.map +1 -1
- package/module/Validate/isNumber.js.map +1 -1
- package/module/Validate/object/core.js +0 -1
- package/module/Validate/object/core.js.map +1 -1
- package/module/Validate/object/index.d.ts +1 -0
- package/module/Validate/object/index.js +1 -0
- package/module/Validate/object/index.js.map +1 -1
- package/module/Validate/object/intersection.d.ts +4 -2
- package/module/Validate/object/intersection.js.map +1 -1
- package/module/Validate/object/nullable.d.ts +8 -0
- package/module/Validate/object/nullable.js +21 -0
- package/module/Validate/object/nullable.js.map +1 -0
- package/module/Validate/object/union.d.ts +4 -2
- package/module/Validate/object/union.js.map +1 -1
- package/module/Validate/string/index.d.ts +1 -0
- package/module/Validate/string/index.js +1 -0
- package/module/Validate/string/index.js.map +1 -1
- package/module/Validate/string/oneOf.d.ts +32 -0
- package/module/Validate/string/oneOf.js +32 -0
- package/module/Validate/string/oneOf.js.map +1 -0
- package/module/es5/Async/debounceAsync.d.ts +18 -0
- package/module/es5/Async/debounceAsync.js +103 -0
- package/module/es5/Async/index.d.ts +5 -0
- package/module/es5/Async/index.js +55 -0
- package/module/es5/Async/pSettled.d.ts +19 -0
- package/module/es5/Async/pSettled.js +68 -0
- package/module/es5/Async/retry.d.ts +22 -0
- package/module/es5/Async/retry.js +106 -0
- package/module/es5/Async/throttleAsync.d.ts +18 -0
- package/module/es5/Async/throttleAsync.js +46 -0
- package/module/es5/Async/waitFor.d.ts +18 -0
- package/module/es5/{Error/retry.js → Async/waitFor.js} +68 -74
- package/module/es5/Date/addDuration.d.ts +15 -0
- package/module/es5/Date/addDuration.js +45 -0
- package/module/es5/Date/diff.d.ts +14 -0
- package/module/es5/Date/diff.js +40 -0
- package/module/es5/Date/durationUnit.d.ts +12 -0
- package/module/es5/Date/durationUnit.js +5 -0
- package/module/es5/Date/endOf.d.ts +13 -0
- package/module/es5/Date/endOf.js +72 -0
- package/module/es5/Date/formatRelative.d.ts +13 -0
- package/module/es5/Date/formatRelative.js +61 -0
- package/module/es5/Date/index.d.ts +10 -0
- package/module/es5/Date/index.js +110 -0
- package/module/es5/Date/isBusinessDay.d.ts +10 -0
- package/module/es5/Date/isBusinessDay.js +26 -0
- package/module/es5/Date/isSameDay.d.ts +10 -0
- package/module/es5/Date/isSameDay.js +18 -0
- package/module/es5/Date/isWeekend.d.ts +9 -0
- package/module/es5/Date/isWeekend.js +18 -0
- package/module/es5/Date/msByUnit.d.ts +2 -0
- package/module/es5/Date/msByUnit.js +15 -0
- package/module/es5/Date/startOf.d.ts +13 -0
- package/module/es5/Date/startOf.js +72 -0
- package/module/es5/Date/subDuration.d.ts +13 -0
- package/module/es5/Date/subDuration.js +21 -0
- package/module/es5/Error/index.d.ts +0 -1
- package/module/es5/Error/index.js +0 -11
- package/module/es5/Object/flattenObject.d.ts +11 -0
- package/module/es5/Object/flattenObject.js +35 -0
- package/module/es5/Object/get.d.ts +1 -0
- package/module/es5/Object/get.js +42 -0
- package/module/es5/Object/has.d.ts +0 -19
- package/module/es5/Object/has.js +4 -4
- package/module/es5/Object/index.d.ts +8 -0
- package/module/es5/Object/index.js +88 -0
- package/module/es5/Object/invert.d.ts +12 -0
- package/module/es5/Object/invert.js +26 -0
- package/module/es5/Object/omitBy.d.ts +11 -0
- package/module/es5/Object/omitBy.js +27 -0
- package/module/es5/Object/pathSegments.d.ts +1 -0
- package/module/es5/Object/pathSegments.js +9 -0
- package/module/es5/Object/pickBy.d.ts +11 -0
- package/module/es5/Object/pickBy.js +27 -0
- package/module/es5/Object/set.d.ts +19 -0
- package/module/es5/Object/set.js +44 -0
- package/module/es5/Object/unflattenObject.d.ts +15 -0
- package/module/es5/Object/unflattenObject.js +30 -0
- package/module/es5/Random/index.d.ts +7 -0
- package/module/es5/Random/index.js +82 -0
- package/module/es5/Random/randomBoolean.d.ts +9 -0
- package/module/es5/Random/randomBoolean.js +18 -0
- package/module/es5/Random/randomChoice.d.ts +9 -0
- package/module/es5/Random/randomChoice.js +18 -0
- package/module/es5/Random/randomFloat.d.ts +9 -0
- package/module/es5/Random/randomFloat.js +17 -0
- package/module/es5/Random/randomInt.d.ts +9 -0
- package/module/es5/Random/randomInt.js +19 -0
- package/module/es5/Random/randomUuid.d.ts +9 -0
- package/module/es5/Random/randomUuid.js +38 -0
- package/module/es5/Random/seededRandom.d.ts +11 -0
- package/module/es5/Random/seededRandom.js +46 -0
- package/module/es5/Random/weightedChoice.d.ts +15 -0
- package/module/es5/Random/weightedChoice.js +50 -0
- package/module/es5/String/capitalize.d.ts +12 -0
- package/module/es5/String/capitalize.js +35 -0
- package/module/es5/String/capitalizeWord.d.ts +1 -0
- package/module/es5/String/capitalizeWord.js +9 -0
- package/module/es5/String/dedent.d.ts +19 -0
- package/module/es5/String/dedent.js +82 -0
- package/module/es5/String/index.d.ts +10 -0
- package/module/es5/String/index.js +110 -0
- package/module/es5/String/mask.d.ts +20 -0
- package/module/es5/String/mask.js +39 -0
- package/module/es5/String/pascalCase.d.ts +9 -0
- package/module/es5/String/pascalCase.js +21 -0
- package/module/es5/String/snakeCase.d.ts +9 -0
- package/module/es5/String/snakeCase.js +20 -0
- package/module/es5/String/titleCase.d.ts +9 -0
- package/module/es5/String/titleCase.js +21 -0
- package/module/es5/String/uncapitalize.d.ts +10 -0
- package/module/es5/String/uncapitalize.js +33 -0
- package/module/es5/String/wordCount.d.ts +10 -0
- package/module/es5/String/wordCount.js +19 -0
- package/module/es5/String/words.d.ts +12 -0
- package/module/es5/String/words.js +25 -0
- package/module/es5/Tool/createPipeline.d.ts +1 -1
- package/module/es5/Tool/createPipeline.js +7 -10
- package/module/es5/URL/buildUrl.d.ts +10 -0
- package/module/es5/URL/buildUrl.js +10 -4
- package/module/es5/URL/parseQueryString.d.ts +6 -0
- package/module/es5/URL/parseQueryString.js +6 -4
- package/module/es5/Validate/object/core.js +0 -1
- package/module/es5/Validate/object/index.d.ts +1 -0
- package/module/es5/Validate/object/index.js +11 -0
- package/module/es5/Validate/object/intersection.d.ts +4 -2
- package/module/es5/Validate/object/intersection.js +6 -0
- package/module/es5/Validate/object/nullable.d.ts +8 -0
- package/module/es5/Validate/object/nullable.js +26 -0
- package/module/es5/Validate/object/union.d.ts +4 -2
- package/module/es5/Validate/object/union.js +6 -0
- package/module/es5/Validate/string/index.d.ts +1 -0
- package/module/es5/Validate/string/index.js +11 -0
- package/module/es5/Validate/string/oneOf.d.ts +32 -0
- package/module/es5/Validate/string/oneOf.js +45 -0
- package/module/es5/index.d.ts +1 -0
- package/module/es5/index.js +20 -9
- package/module/index.d.ts +1 -0
- package/module/index.js +1 -0
- package/module/index.js.map +1 -1
- package/package.json +33 -25
- package/module/Error/retry.d.ts +0 -37
- package/module/Error/retry.js +0 -47
- package/module/Error/retry.js.map +0 -1
- package/module/es5/Error/retry.d.ts +0 -37
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.createPipeline =
|
|
6
|
+
exports.createPipeline = createPipeline;
|
|
7
7
|
/**
|
|
8
8
|
* Interface representing a pipeline.
|
|
9
9
|
* When called without arguments, returns the stored value.
|
|
@@ -20,12 +20,9 @@ exports.createPipeline = void 0;
|
|
|
20
20
|
* pipeline(); // 1
|
|
21
21
|
* pipeline((x) => x + 1)(); // 2
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
};
|
|
23
|
+
function createPipeline(initialValue) {
|
|
24
|
+
function pipeline(transformer) {
|
|
25
|
+
return transformer ? createPipeline(transformer(initialValue)) : initialValue;
|
|
26
|
+
}
|
|
27
|
+
return pipeline;
|
|
28
|
+
}
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* @param params - An object of key-value pairs to append as query parameters
|
|
6
6
|
* @returns The complete URL string with query parameters
|
|
7
7
|
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
10
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
11
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
12
|
+
* `removePrototype*` helper before calling this function:
|
|
13
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
14
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
15
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
16
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
17
|
+
*
|
|
8
18
|
* @example
|
|
9
19
|
* ```typescript
|
|
10
20
|
* buildUrl("https://example.com", { page: "1", q: "search" });
|
|
@@ -11,6 +11,16 @@ exports.buildUrl = void 0;
|
|
|
11
11
|
* @param params - An object of key-value pairs to append as query parameters
|
|
12
12
|
* @returns The complete URL string with query parameters
|
|
13
13
|
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
16
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
17
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
18
|
+
* `removePrototype*` helper before calling this function:
|
|
19
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
20
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
21
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
22
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
23
|
+
*
|
|
14
24
|
* @example
|
|
15
25
|
* ```typescript
|
|
16
26
|
* buildUrl("https://example.com", { page: "1", q: "search" });
|
|
@@ -25,10 +35,6 @@ var buildUrl = exports.buildUrl = function buildUrl(base) {
|
|
|
25
35
|
var url = new URL(base);
|
|
26
36
|
for (var _i = 0, _Object$keys = Object.keys(parameters); _i < _Object$keys.length; _i++) {
|
|
27
37
|
var key = _Object$keys[_i];
|
|
28
|
-
// Prevent prototype pollution by rejecting dangerous keys
|
|
29
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
38
|
url.searchParams.append(key, parameters[key]);
|
|
33
39
|
}
|
|
34
40
|
return url.toString();
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* @param query - The query string or URL to parse
|
|
8
8
|
* @returns A record of key-value pairs from the query string
|
|
9
9
|
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
12
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
13
|
+
* If processing user-controlled input, sanitize the result with
|
|
14
|
+
* `removePrototype` after calling this function.
|
|
15
|
+
*
|
|
10
16
|
* @example
|
|
11
17
|
* ```typescript
|
|
12
18
|
* parseQueryString("?page=1&q=search");
|
|
@@ -20,6 +20,12 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
20
20
|
* @param query - The query string or URL to parse
|
|
21
21
|
* @returns A record of key-value pairs from the query string
|
|
22
22
|
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
25
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
26
|
+
* If processing user-controlled input, sanitize the result with
|
|
27
|
+
* `removePrototype` after calling this function.
|
|
28
|
+
*
|
|
23
29
|
* @example
|
|
24
30
|
* ```typescript
|
|
25
31
|
* parseQueryString("?page=1&q=search");
|
|
@@ -46,10 +52,6 @@ var parseQueryString = exports.parseQueryString = function parseQueryString(quer
|
|
|
46
52
|
var _step$value = _slicedToArray(_step.value, 2),
|
|
47
53
|
key = _step$value[0],
|
|
48
54
|
value = _step$value[1];
|
|
49
|
-
// Prevent prototype pollution by rejecting dangerous keys
|
|
50
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
55
|
result[key] = value;
|
|
54
56
|
}
|
|
55
57
|
} catch (err) {
|
|
@@ -25,7 +25,6 @@ var object = exports.object = function object() {
|
|
|
25
25
|
return {
|
|
26
26
|
validate: false,
|
|
27
27
|
message: message !== null && message !== void 0 ? message : "",
|
|
28
|
-
// biome-ignore lint/suspicious/noExplicitAny: Type assertion needed for return type compatibility
|
|
29
28
|
type: value
|
|
30
29
|
};
|
|
31
30
|
}
|
|
@@ -25,6 +25,17 @@ Object.keys(_intersection).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _nullable = require("./nullable");
|
|
29
|
+
Object.keys(_nullable).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _nullable[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _nullable[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
var _optional = require("./optional");
|
|
29
40
|
Object.keys(_optional).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { UnionToIntersection } from "../../types/logic";
|
|
2
|
-
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
3
|
-
type ExtractValidatedType<V> = V extends (value: never) =>
|
|
2
|
+
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
3
|
+
type ExtractValidatedType<V> = V extends (value: never) => {
|
|
4
|
+
type: infer T;
|
|
5
|
+
} ? ValidateType<T> : never;
|
|
4
6
|
/**
|
|
5
7
|
* Creates an intersection validator that passes only if all given validators pass
|
|
6
8
|
* @param validators - Validator functions to compose as an intersection (logical AND)
|
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.intersection = void 0;
|
|
7
|
+
// Extract the validated value type by reading the validator's `type` field
|
|
8
|
+
// (and applying `ValidateType` to map type tags like "string" back to the
|
|
9
|
+
// runtime type). Reading the field directly lets validators that expose the
|
|
10
|
+
// literal union via the `type` field (such as `oneOf`) flow through
|
|
11
|
+
// intersection without being collapsed by `Types<T>`.
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* Creates an intersection validator that passes only if all given validators pass
|
|
9
15
|
* @param validators - Validator functions to compose as an intersection (logical AND)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a validator to accept null values
|
|
4
|
+
* @template T - The type of value the wrapped validator expects
|
|
5
|
+
* @param {Function} validator - Validator function to make nullable
|
|
6
|
+
* @returns {Function} - Validator that passes for null or delegates to the wrapped validator
|
|
7
|
+
*/
|
|
8
|
+
export declare const nullable: <T>(validator: (value: T) => ValidateCoreReturnType<T>) => ((value: T | null) => ValidateCoreReturnType<T | null>);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nullable = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a validator to accept null values
|
|
9
|
+
* @template T - The type of value the wrapped validator expects
|
|
10
|
+
* @param {Function} validator - Validator function to make nullable
|
|
11
|
+
* @returns {Function} - Validator that passes for null or delegates to the wrapped validator
|
|
12
|
+
*/
|
|
13
|
+
var nullable = exports.nullable = function nullable(validator) {
|
|
14
|
+
var nullableValidator = function nullableValidator(value) {
|
|
15
|
+
if (value === null) {
|
|
16
|
+
return {
|
|
17
|
+
validate: true,
|
|
18
|
+
message: "",
|
|
19
|
+
type: "null"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var result = validator(value);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
return nullableValidator;
|
|
26
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
2
|
-
type ExtractValidatedType<V> = V extends (value: never) =>
|
|
1
|
+
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
2
|
+
type ExtractValidatedType<V> = V extends (value: never) => {
|
|
3
|
+
type: infer T;
|
|
4
|
+
} ? ValidateType<T> : never;
|
|
3
5
|
/**
|
|
4
6
|
* Creates a union validator that passes if any of the given validators pass
|
|
5
7
|
* @param validators - Validator functions to compose as a union (logical OR)
|
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.union = void 0;
|
|
7
|
+
// Extract the validated value type by reading the validator's `type` field
|
|
8
|
+
// (and applying `ValidateType` to map type tags like "string" back to the
|
|
9
|
+
// runtime type). Reading the field directly lets validators that expose the
|
|
10
|
+
// literal union via the `type` field (such as `oneOf`) flow through union
|
|
11
|
+
// without being collapsed by `Types<T>`.
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* Creates a union validator that passes if any of the given validators pass
|
|
9
15
|
* @param validators - Validator functions to compose as a union (logical OR)
|
|
@@ -69,6 +69,17 @@ Object.keys(_numberString).forEach(function (key) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
+
var _oneOf = require("./oneOf");
|
|
73
|
+
Object.keys(_oneOf).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _oneOf[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return _oneOf[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
72
83
|
var _regexMatch = require("./regexMatch");
|
|
73
84
|
Object.keys(_regexMatch).forEach(function (key) {
|
|
74
85
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String validation module for literal union (allowed values) check
|
|
3
|
+
* Provides validation functionality for checking if a string is one of the
|
|
4
|
+
* allowed literal values, useful for validating string literal union types
|
|
5
|
+
* such as `'standard' | 'squat' | 'decanter' | 'round' | 'tall' | 'flask'`.
|
|
6
|
+
*
|
|
7
|
+
* The validator's return type carries the literal union through its `type`
|
|
8
|
+
* field directly (instead of going through `Types<T>` which would collapse
|
|
9
|
+
* to `"string"`), so consumers like `object()`, `union()`, and `intersection()`
|
|
10
|
+
* can preserve the literal union in their inferred types.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Return type produced by a `oneOf` validator. Structurally compatible with
|
|
14
|
+
* `ValidateCoreReturnType<unknown>`, but exposes the literal union directly
|
|
15
|
+
* via the `type` field so the inferred type can flow through `object()`,
|
|
16
|
+
* `union()`, and `intersection()` without being collapsed to `string`.
|
|
17
|
+
*/
|
|
18
|
+
export interface OneOfReturnType<T extends string> {
|
|
19
|
+
validate: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
type: T;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a top-level validator that checks if a string value is one of the
|
|
25
|
+
* given allowed literal values. The literal union is captured via `const T`
|
|
26
|
+
* and exposed through the `OneOfReturnType<T[number]>` return type.
|
|
27
|
+
* @template T - The tuple of allowed string literals
|
|
28
|
+
* @param {T} values - The tuple of allowed string values
|
|
29
|
+
* @param {string} [message] - Custom error message for validation failure
|
|
30
|
+
* @returns A validator function from `string` to `OneOfReturnType<T[number]>`
|
|
31
|
+
*/
|
|
32
|
+
export declare const oneOf: <const T extends readonly string[]>(values: T, message?: string) => (value: string) => OneOfReturnType<T[number]>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.oneOf = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* String validation module for literal union (allowed values) check
|
|
9
|
+
* Provides validation functionality for checking if a string is one of the
|
|
10
|
+
* allowed literal values, useful for validating string literal union types
|
|
11
|
+
* such as `'standard' | 'squat' | 'decanter' | 'round' | 'tall' | 'flask'`.
|
|
12
|
+
*
|
|
13
|
+
* The validator's return type carries the literal union through its `type`
|
|
14
|
+
* field directly (instead of going through `Types<T>` which would collapse
|
|
15
|
+
* to `"string"`), so consumers like `object()`, `union()`, and `intersection()`
|
|
16
|
+
* can preserve the literal union in their inferred types.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Return type produced by a `oneOf` validator. Structurally compatible with
|
|
21
|
+
* `ValidateCoreReturnType<unknown>`, but exposes the literal union directly
|
|
22
|
+
* via the `type` field so the inferred type can flow through `object()`,
|
|
23
|
+
* `union()`, and `intersection()` without being collapsed to `string`.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a top-level validator that checks if a string value is one of the
|
|
28
|
+
* given allowed literal values. The literal union is captured via `const T`
|
|
29
|
+
* and exposed through the `OneOfReturnType<T[number]>` return type.
|
|
30
|
+
* @template T - The tuple of allowed string literals
|
|
31
|
+
* @param {T} values - The tuple of allowed string values
|
|
32
|
+
* @param {string} [message] - Custom error message for validation failure
|
|
33
|
+
* @returns A validator function from `string` to `OneOfReturnType<T[number]>`
|
|
34
|
+
*/
|
|
35
|
+
var oneOf = exports.oneOf = function oneOf(values, message) {
|
|
36
|
+
var allowed = new Set(values);
|
|
37
|
+
return function (value) {
|
|
38
|
+
var isValid = allowed.has(value);
|
|
39
|
+
return {
|
|
40
|
+
validate: isValid,
|
|
41
|
+
message: isValid ? "" : message !== null && message !== void 0 ? message : "",
|
|
42
|
+
type: value
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
package/module/es5/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./Math/index";
|
|
|
14
14
|
export * from "./Number/index";
|
|
15
15
|
export * from "./Object/index";
|
|
16
16
|
export * from "./Predicate/index";
|
|
17
|
+
export * from "./Random/index";
|
|
17
18
|
export * from "./Simple/index";
|
|
18
19
|
export * from "./String/index";
|
|
19
20
|
export * from "./Time/index";
|
package/module/es5/index.js
CHANGED
|
@@ -179,7 +179,7 @@ Object.keys(_index14).forEach(function (key) {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
|
-
var _index15 = require("./
|
|
182
|
+
var _index15 = require("./Random/index");
|
|
183
183
|
Object.keys(_index15).forEach(function (key) {
|
|
184
184
|
if (key === "default" || key === "__esModule") return;
|
|
185
185
|
if (key in exports && exports[key] === _index15[key]) return;
|
|
@@ -190,7 +190,7 @@ Object.keys(_index15).forEach(function (key) {
|
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
});
|
|
193
|
-
var _index16 = require("./
|
|
193
|
+
var _index16 = require("./Simple/index");
|
|
194
194
|
Object.keys(_index16).forEach(function (key) {
|
|
195
195
|
if (key === "default" || key === "__esModule") return;
|
|
196
196
|
if (key in exports && exports[key] === _index16[key]) return;
|
|
@@ -201,7 +201,7 @@ Object.keys(_index16).forEach(function (key) {
|
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
|
-
var _index17 = require("./
|
|
204
|
+
var _index17 = require("./String/index");
|
|
205
205
|
Object.keys(_index17).forEach(function (key) {
|
|
206
206
|
if (key === "default" || key === "__esModule") return;
|
|
207
207
|
if (key in exports && exports[key] === _index17[key]) return;
|
|
@@ -212,7 +212,7 @@ Object.keys(_index17).forEach(function (key) {
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
|
-
var _index18 = require("./
|
|
215
|
+
var _index18 = require("./Time/index");
|
|
216
216
|
Object.keys(_index18).forEach(function (key) {
|
|
217
217
|
if (key === "default" || key === "__esModule") return;
|
|
218
218
|
if (key in exports && exports[key] === _index18[key]) return;
|
|
@@ -223,7 +223,7 @@ Object.keys(_index18).forEach(function (key) {
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
|
-
var _index19 = require("./
|
|
226
|
+
var _index19 = require("./Tool/index");
|
|
227
227
|
Object.keys(_index19).forEach(function (key) {
|
|
228
228
|
if (key === "default" || key === "__esModule") return;
|
|
229
229
|
if (key in exports && exports[key] === _index19[key]) return;
|
|
@@ -234,7 +234,7 @@ Object.keys(_index19).forEach(function (key) {
|
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
});
|
|
237
|
-
var _index20 = require("./
|
|
237
|
+
var _index20 = require("./types/index");
|
|
238
238
|
Object.keys(_index20).forEach(function (key) {
|
|
239
239
|
if (key === "default" || key === "__esModule") return;
|
|
240
240
|
if (key in exports && exports[key] === _index20[key]) return;
|
|
@@ -245,7 +245,7 @@ Object.keys(_index20).forEach(function (key) {
|
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
-
var _index21 = require("./
|
|
248
|
+
var _index21 = require("./UA/index");
|
|
249
249
|
Object.keys(_index21).forEach(function (key) {
|
|
250
250
|
if (key === "default" || key === "__esModule") return;
|
|
251
251
|
if (key in exports && exports[key] === _index21[key]) return;
|
|
@@ -256,7 +256,7 @@ Object.keys(_index21).forEach(function (key) {
|
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
|
-
var _index22 = require("./
|
|
259
|
+
var _index22 = require("./Unit/index");
|
|
260
260
|
Object.keys(_index22).forEach(function (key) {
|
|
261
261
|
if (key === "default" || key === "__esModule") return;
|
|
262
262
|
if (key in exports && exports[key] === _index22[key]) return;
|
|
@@ -267,7 +267,7 @@ Object.keys(_index22).forEach(function (key) {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
|
-
var _index23 = require("./
|
|
270
|
+
var _index23 = require("./URL/index");
|
|
271
271
|
Object.keys(_index23).forEach(function (key) {
|
|
272
272
|
if (key === "default" || key === "__esModule") return;
|
|
273
273
|
if (key in exports && exports[key] === _index23[key]) return;
|
|
@@ -277,4 +277,15 @@ Object.keys(_index23).forEach(function (key) {
|
|
|
277
277
|
return _index23[key];
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
|
+
});
|
|
281
|
+
var _index24 = require("./Validate/index");
|
|
282
|
+
Object.keys(_index24).forEach(function (key) {
|
|
283
|
+
if (key === "default" || key === "__esModule") return;
|
|
284
|
+
if (key in exports && exports[key] === _index24[key]) return;
|
|
285
|
+
Object.defineProperty(exports, key, {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function get() {
|
|
288
|
+
return _index24[key];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
280
291
|
});
|
package/module/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./Math/index";
|
|
|
14
14
|
export * from "./Number/index";
|
|
15
15
|
export * from "./Object/index";
|
|
16
16
|
export * from "./Predicate/index";
|
|
17
|
+
export * from "./Random/index";
|
|
17
18
|
export * from "./Simple/index";
|
|
18
19
|
export * from "./String/index";
|
|
19
20
|
export * from "./Time/index";
|
package/module/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./Math/index";
|
|
|
14
14
|
export * from "./Number/index";
|
|
15
15
|
export * from "./Object/index";
|
|
16
16
|
export * from "./Predicate/index";
|
|
17
|
+
export * from "./Random/index";
|
|
17
18
|
export * from "./Simple/index";
|
|
18
19
|
export * from "./String/index";
|
|
19
20
|
export * from "./Time/index";
|
package/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
"@babel/core": "7.29.0",
|
|
10
10
|
"@babel/preset-env": "7.29.2",
|
|
11
11
|
"@babel/preset-typescript": "7.28.5",
|
|
12
|
-
"@biomejs/biome": "2.4.
|
|
12
|
+
"@biomejs/biome": "2.4.13",
|
|
13
13
|
"@codecov/bundle-analyzer": "2.0.1",
|
|
14
14
|
"@eslint/js": "10.0.1",
|
|
15
|
-
"@swc/core": "1.15.
|
|
15
|
+
"@swc/core": "1.15.32",
|
|
16
16
|
"@swc/jest": "0.2.39",
|
|
17
|
-
"@types/bun": "1.3.
|
|
17
|
+
"@types/bun": "1.3.13",
|
|
18
18
|
"@types/jest": "30.0.0",
|
|
19
19
|
"@types/lodash": "4.17.24",
|
|
20
20
|
"@types/node": "25.6.0",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
22
|
-
"@typescript-eslint/parser": "8.
|
|
23
|
-
"bun-types": "1.3.
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "8.59.1",
|
|
22
|
+
"@typescript-eslint/parser": "8.59.1",
|
|
23
|
+
"bun-types": "1.3.13",
|
|
24
24
|
"dependency-cruiser": "17.3.10",
|
|
25
|
-
"es-toolkit": "1.
|
|
25
|
+
"es-toolkit": "1.46.0",
|
|
26
26
|
"eslint": "10.2.1",
|
|
27
27
|
"eslint-plugin-baseline-js": "0.6.2",
|
|
28
28
|
"eslint-plugin-import": "2.32.0",
|
|
@@ -30,15 +30,17 @@
|
|
|
30
30
|
"fast-sort": "3.4.1",
|
|
31
31
|
"gh-pages": "6.3.0",
|
|
32
32
|
"jest": "30.3.0",
|
|
33
|
-
"jest-junit": "
|
|
33
|
+
"jest-junit": "17.0.0",
|
|
34
34
|
"lodash": "4.18.1",
|
|
35
35
|
"mitata": "1.0.34",
|
|
36
36
|
"ts-jest": "29.4.9",
|
|
37
37
|
"ts-node": "10.9.2",
|
|
38
38
|
"tsc-alias": "1.8.16",
|
|
39
39
|
"typedoc": "0.28.19",
|
|
40
|
+
"typedoc-github-wiki-theme": "2.1.0",
|
|
41
|
+
"typedoc-plugin-markdown": "4.11.0",
|
|
40
42
|
"typescript": "6.0.3",
|
|
41
|
-
"typescript-eslint": "8.
|
|
43
|
+
"typescript-eslint": "8.59.1"
|
|
42
44
|
},
|
|
43
45
|
"exports": {
|
|
44
46
|
".": {
|
|
@@ -126,6 +128,11 @@
|
|
|
126
128
|
"import": "./module/Predicate/index.js",
|
|
127
129
|
"default": "./module/Predicate/index.js"
|
|
128
130
|
},
|
|
131
|
+
"./Random": {
|
|
132
|
+
"types": "./module/Random/index.d.ts",
|
|
133
|
+
"import": "./module/Random/index.js",
|
|
134
|
+
"default": "./module/Random/index.js"
|
|
135
|
+
},
|
|
129
136
|
"./Simple": {
|
|
130
137
|
"types": "./module/Simple/index.d.ts",
|
|
131
138
|
"import": "./module/Simple/index.js",
|
|
@@ -200,23 +207,24 @@
|
|
|
200
207
|
"url": "git+https://github.com/riya-amemiya/UMT.git"
|
|
201
208
|
},
|
|
202
209
|
"scripts": {
|
|
203
|
-
"build": "
|
|
204
|
-
"build:cjs": "
|
|
205
|
-
"build:babel": "
|
|
206
|
-
"build:cjs:babel": "
|
|
207
|
-
"build:full": "
|
|
208
|
-
"build:clean": "
|
|
209
|
-
"build:clean:full": "
|
|
210
|
-
"deploy": "
|
|
211
|
-
"eslint": "eslint
|
|
212
|
-
"format": "
|
|
213
|
-
"lint": "
|
|
214
|
-
"lint:ci": "
|
|
215
|
-
"
|
|
216
|
-
"test
|
|
217
|
-
"
|
|
210
|
+
"build": "nix develop --command make build",
|
|
211
|
+
"build:cjs": "nix develop --command make build-cjs",
|
|
212
|
+
"build:babel": "nix develop --command make build-babel",
|
|
213
|
+
"build:cjs:babel": "nix develop --command make build-cjs-babel",
|
|
214
|
+
"build:full": "nix develop --command make build-full",
|
|
215
|
+
"build:clean": "nix develop --command make build-clean",
|
|
216
|
+
"build:clean:full": "nix develop --command make build-clean-full",
|
|
217
|
+
"deploy": "nix develop --command make deploy",
|
|
218
|
+
"eslint": "nix develop --command make eslint",
|
|
219
|
+
"format": "nix develop --command make format",
|
|
220
|
+
"lint": "nix develop --command make lint",
|
|
221
|
+
"lint:ci": "nix develop --command make lint-ci",
|
|
222
|
+
"readme": "nix develop --command make readme",
|
|
223
|
+
"test": "nix develop --command make test",
|
|
224
|
+
"test-debug": "nix develop --command make test-debug",
|
|
225
|
+
"ts-node": "nix develop --command make ts-node"
|
|
218
226
|
},
|
|
219
227
|
"type": "module",
|
|
220
228
|
"types": "module/index.d.ts",
|
|
221
|
-
"version": "2.
|
|
229
|
+
"version": "2.18.0"
|
|
222
230
|
}
|
package/module/Error/retry.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface RetryOptions {
|
|
2
|
-
retries?: number;
|
|
3
|
-
delay?: number;
|
|
4
|
-
shouldRetry?: (error: unknown) => boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Retries a given async function with configurable retry logic
|
|
8
|
-
*
|
|
9
|
-
* @template T - The return type of the function
|
|
10
|
-
* @param function_ - The async function to retry
|
|
11
|
-
* @param options - Configuration options for retry behavior
|
|
12
|
-
* @param options.retries - Maximum number of retry attempts (default: 3)
|
|
13
|
-
* @param options.delay - Delay between retries in milliseconds (default: 1000)
|
|
14
|
-
* @param options.shouldRetry - Function to determine if an error should trigger a retry (default: always retry)
|
|
15
|
-
* @returns Promise that resolves with the function result or rejects with the final error
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* // Basic usage with default options
|
|
20
|
-
* const result = await retry(async () => {
|
|
21
|
-
* const response = await fetch('/api/data');
|
|
22
|
-
* if (!response.ok) throw new Error('Failed to fetch');
|
|
23
|
-
* return response.json();
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* // Custom retry configuration
|
|
27
|
-
* const result = await retry(
|
|
28
|
-
* () => riskyOperation(),
|
|
29
|
-
* {
|
|
30
|
-
* retries: 5,
|
|
31
|
-
* delay: 2000,
|
|
32
|
-
* shouldRetry: (error) => error instanceof NetworkError
|
|
33
|
-
* }
|
|
34
|
-
* );
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const retry: <T>(function_: () => Promise<T>, options?: RetryOptions) => Promise<T>;
|