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
package/module/Error/retry.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retries a given async function with configurable retry logic
|
|
3
|
-
*
|
|
4
|
-
* @template T - The return type of the function
|
|
5
|
-
* @param function_ - The async function to retry
|
|
6
|
-
* @param options - Configuration options for retry behavior
|
|
7
|
-
* @param options.retries - Maximum number of retry attempts (default: 3)
|
|
8
|
-
* @param options.delay - Delay between retries in milliseconds (default: 1000)
|
|
9
|
-
* @param options.shouldRetry - Function to determine if an error should trigger a retry (default: always retry)
|
|
10
|
-
* @returns Promise that resolves with the function result or rejects with the final error
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Basic usage with default options
|
|
15
|
-
* const result = await retry(async () => {
|
|
16
|
-
* const response = await fetch('/api/data');
|
|
17
|
-
* if (!response.ok) throw new Error('Failed to fetch');
|
|
18
|
-
* return response.json();
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* // Custom retry configuration
|
|
22
|
-
* const result = await retry(
|
|
23
|
-
* () => riskyOperation(),
|
|
24
|
-
* {
|
|
25
|
-
* retries: 5,
|
|
26
|
-
* delay: 2000,
|
|
27
|
-
* shouldRetry: (error) => error instanceof NetworkError
|
|
28
|
-
* }
|
|
29
|
-
* );
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export const retry = (function_, options = {}) => {
|
|
33
|
-
const { retries = 3, delay = 1000, shouldRetry = () => true } = options;
|
|
34
|
-
const attempt = async (remainingAttempts) => {
|
|
35
|
-
try {
|
|
36
|
-
return await function_();
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
if (remainingAttempts <= 0 || !shouldRetry(error)) {
|
|
40
|
-
throw error;
|
|
41
|
-
}
|
|
42
|
-
return await new Promise((resolve) => setTimeout(() => resolve(attempt(remainingAttempts - 1)), delay));
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return attempt(retries);
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=retry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/Error/retry.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,SAA2B,EAC3B,UAAwB,EAAE,EACd,EAAE;IACd,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC;IACxE,MAAM,OAAO,GAAG,KAAK,EAAE,iBAAyB,EAAc,EAAE;QAC9D,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,iBAAiB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACnC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CACjE,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -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>;
|