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/String/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./camelCase";
|
|
2
|
+
export * from "./capitalize";
|
|
3
|
+
export * from "./capitalizeWord";
|
|
4
|
+
export * from "./dedent";
|
|
2
5
|
export * from "./deleteSpaces";
|
|
3
6
|
export * from "./escapeHtml";
|
|
4
7
|
export * from "./formatString";
|
|
@@ -7,18 +10,25 @@ export * from "./fuzzySearch";
|
|
|
7
10
|
export * from "./hasNoLetters";
|
|
8
11
|
export * from "./kebabCase";
|
|
9
12
|
export * from "./levenshteinDistance";
|
|
13
|
+
export * from "./mask";
|
|
10
14
|
export * from "./padEnd";
|
|
11
15
|
export * from "./padStart";
|
|
16
|
+
export * from "./pascalCase";
|
|
12
17
|
export * from "./randomString";
|
|
13
18
|
export * from "./randomStringInitialization";
|
|
14
19
|
export * from "./reverseString";
|
|
15
20
|
export * from "./slugify";
|
|
21
|
+
export * from "./snakeCase";
|
|
16
22
|
export * from "./stringSimilarity";
|
|
23
|
+
export * from "./titleCase";
|
|
17
24
|
export * from "./toBase64";
|
|
18
25
|
export * from "./toHalfWidth";
|
|
19
26
|
export * from "./trimCharacters";
|
|
20
27
|
export * from "./trimEndCharacters";
|
|
21
28
|
export * from "./trimStartCharacters";
|
|
22
29
|
export * from "./truncate";
|
|
30
|
+
export * from "./uncapitalize";
|
|
23
31
|
export * from "./unescapeHtml";
|
|
32
|
+
export * from "./wordCount";
|
|
33
|
+
export * from "./words";
|
|
24
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/String/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/String/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface MaskOptions {
|
|
2
|
+
/** Number of leading characters to keep visible. Default: 1 */
|
|
3
|
+
start?: number;
|
|
4
|
+
/** Number of trailing characters to keep visible. Default: 1 */
|
|
5
|
+
end?: number;
|
|
6
|
+
/** Mask character. Default: "*" */
|
|
7
|
+
char?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Masks the middle portion of a string with a fill character, preserving the
|
|
11
|
+
* leading and trailing visible counts. Surrogate-pair safe.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} string_ - Input string
|
|
14
|
+
* @param {MaskOptions} [options] - Visible-character counts and mask char
|
|
15
|
+
* @returns {string} Masked string
|
|
16
|
+
* @example
|
|
17
|
+
* mask("1234567890", { start: 2, end: 4 }); // "12****7890"
|
|
18
|
+
* mask("secret"); // "s****t"
|
|
19
|
+
*/
|
|
20
|
+
export declare const mask: (string_: string, options?: MaskOptions) => string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Masks the middle portion of a string with a fill character, preserving the
|
|
3
|
+
* leading and trailing visible counts. Surrogate-pair safe.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @param {MaskOptions} [options] - Visible-character counts and mask char
|
|
7
|
+
* @returns {string} Masked string
|
|
8
|
+
* @example
|
|
9
|
+
* mask("1234567890", { start: 2, end: 4 }); // "12****7890"
|
|
10
|
+
* mask("secret"); // "s****t"
|
|
11
|
+
*/
|
|
12
|
+
export const mask = (string_, options = {}) => {
|
|
13
|
+
const { start = 1, end = 1, char = "*" } = options;
|
|
14
|
+
const graphemes = [...string_];
|
|
15
|
+
const length = graphemes.length;
|
|
16
|
+
if (start + end >= length) {
|
|
17
|
+
return string_;
|
|
18
|
+
}
|
|
19
|
+
const middleLength = length - start - end;
|
|
20
|
+
return (graphemes.slice(0, start).join("") +
|
|
21
|
+
char.repeat(middleLength) +
|
|
22
|
+
graphemes.slice(length - end).join(""));
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../src/String/mask.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,UAAuB,EAAE,EAAU,EAAE;IACzE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,KAAK,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC;IAC1C,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACvC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to PascalCase.
|
|
3
|
+
* @param {string} string_ - Input string
|
|
4
|
+
* @returns {string} PascalCase string
|
|
5
|
+
* @example
|
|
6
|
+
* pascalCase("hello-world"); // "HelloWorld"
|
|
7
|
+
* pascalCase("hello_world"); // "HelloWorld"
|
|
8
|
+
*/
|
|
9
|
+
export declare const pascalCase: (string_: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { capitalizeWord } from "./capitalizeWord";
|
|
2
|
+
import { words } from "./words";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to PascalCase.
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @returns {string} PascalCase string
|
|
7
|
+
* @example
|
|
8
|
+
* pascalCase("hello-world"); // "HelloWorld"
|
|
9
|
+
* pascalCase("hello_world"); // "HelloWorld"
|
|
10
|
+
*/
|
|
11
|
+
export const pascalCase = (string_) => words(string_)
|
|
12
|
+
.map((word) => capitalizeWord(word))
|
|
13
|
+
.join("");
|
|
14
|
+
//# sourceMappingURL=pascalCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pascalCase.js","sourceRoot":"","sources":["../../src/String/pascalCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE,CACpD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACnC,IAAI,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to snake_case.
|
|
3
|
+
* @param {string} string_ - Input string
|
|
4
|
+
* @returns {string} snake_case string
|
|
5
|
+
* @example
|
|
6
|
+
* snakeCase("helloWorld"); // "hello_world"
|
|
7
|
+
* snakeCase("Hello World"); // "hello_world"
|
|
8
|
+
*/
|
|
9
|
+
export declare const snakeCase: (string_: string) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { words } from "./words";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a string to snake_case.
|
|
4
|
+
* @param {string} string_ - Input string
|
|
5
|
+
* @returns {string} snake_case string
|
|
6
|
+
* @example
|
|
7
|
+
* snakeCase("helloWorld"); // "hello_world"
|
|
8
|
+
* snakeCase("Hello World"); // "hello_world"
|
|
9
|
+
*/
|
|
10
|
+
export const snakeCase = (string_) => words(string_)
|
|
11
|
+
.map((word) => word.toLowerCase())
|
|
12
|
+
.join("_");
|
|
13
|
+
//# sourceMappingURL=snakeCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snakeCase.js","sourceRoot":"","sources":["../../src/String/snakeCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CACnD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to Title Case (each word capitalized, separated by spaces).
|
|
3
|
+
* @param {string} string_ - Input string
|
|
4
|
+
* @returns {string} Title Case string
|
|
5
|
+
* @example
|
|
6
|
+
* titleCase("hello world"); // "Hello World"
|
|
7
|
+
* titleCase("a-quick brown_fox"); // "A Quick Brown Fox"
|
|
8
|
+
*/
|
|
9
|
+
export declare const titleCase: (string_: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { capitalizeWord } from "./capitalizeWord";
|
|
2
|
+
import { words } from "./words";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to Title Case (each word capitalized, separated by spaces).
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @returns {string} Title Case string
|
|
7
|
+
* @example
|
|
8
|
+
* titleCase("hello world"); // "Hello World"
|
|
9
|
+
* titleCase("a-quick brown_fox"); // "A Quick Brown Fox"
|
|
10
|
+
*/
|
|
11
|
+
export const titleCase = (string_) => words(string_)
|
|
12
|
+
.map((word) => capitalizeWord(word))
|
|
13
|
+
.join(" ");
|
|
14
|
+
//# sourceMappingURL=titleCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titleCase.js","sourceRoot":"","sources":["../../src/String/titleCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CACnD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACnC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowercases the first grapheme of a string. Surrogate-pair safe.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string_ - Input string
|
|
5
|
+
* @returns {string} String with the first grapheme lowercased
|
|
6
|
+
* @example
|
|
7
|
+
* uncapitalize("Hello"); // "hello"
|
|
8
|
+
* uncapitalize("ÉCLAIR"); // "éCLAIR"
|
|
9
|
+
*/
|
|
10
|
+
export declare const uncapitalize: (string_: string) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowercases the first grapheme of a string. Surrogate-pair safe.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string_ - Input string
|
|
5
|
+
* @returns {string} String with the first grapheme lowercased
|
|
6
|
+
* @example
|
|
7
|
+
* uncapitalize("Hello"); // "hello"
|
|
8
|
+
* uncapitalize("ÉCLAIR"); // "éCLAIR"
|
|
9
|
+
*/
|
|
10
|
+
export const uncapitalize = (string_) => {
|
|
11
|
+
for (const first of string_) {
|
|
12
|
+
return first.toLowerCase() + string_.slice(first.length);
|
|
13
|
+
}
|
|
14
|
+
return string_;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=uncapitalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uncapitalize.js","sourceRoot":"","sources":["../../src/String/uncapitalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counts words in a string using the same boundaries as `words`.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string_ - Input string
|
|
5
|
+
* @returns {number} Word count
|
|
6
|
+
* @example
|
|
7
|
+
* wordCount("hello world"); // 2
|
|
8
|
+
* wordCount("camelCase split"); // 3
|
|
9
|
+
*/
|
|
10
|
+
export declare const wordCount: (string_: string) => number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { words } from "./words";
|
|
2
|
+
/**
|
|
3
|
+
* Counts words in a string using the same boundaries as `words`.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @returns {number} Word count
|
|
7
|
+
* @example
|
|
8
|
+
* wordCount("hello world"); // 2
|
|
9
|
+
* wordCount("camelCase split"); // 3
|
|
10
|
+
*/
|
|
11
|
+
export const wordCount = (string_) => words(string_).length;
|
|
12
|
+
//# sourceMappingURL=wordCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordCount.js","sourceRoot":"","sources":["../../src/String/wordCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a string into words on case boundaries and non-alphanumeric separators.
|
|
3
|
+
* Uses Unicode property escapes so CJK and other letters are preserved.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @param {RegExp} [pattern] - Custom matching pattern; defaults to a Unicode word matcher
|
|
7
|
+
* @returns {string[]} Array of words
|
|
8
|
+
* @example
|
|
9
|
+
* words("helloWorld foo-bar"); // ["hello", "World", "foo", "bar"]
|
|
10
|
+
* words("XMLHttpRequest"); // ["XML", "Http", "Request"]
|
|
11
|
+
*/
|
|
12
|
+
export declare const words: (string_: string, pattern?: RegExp) => string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a string into words on case boundaries and non-alphanumeric separators.
|
|
3
|
+
* Uses Unicode property escapes so CJK and other letters are preserved.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} string_ - Input string
|
|
6
|
+
* @param {RegExp} [pattern] - Custom matching pattern; defaults to a Unicode word matcher
|
|
7
|
+
* @returns {string[]} Array of words
|
|
8
|
+
* @example
|
|
9
|
+
* words("helloWorld foo-bar"); // ["hello", "World", "foo", "bar"]
|
|
10
|
+
* words("XMLHttpRequest"); // ["XML", "Http", "Request"]
|
|
11
|
+
*/
|
|
12
|
+
export const words = (string_, pattern) => {
|
|
13
|
+
if (pattern) {
|
|
14
|
+
return string_.match(pattern) ?? [];
|
|
15
|
+
}
|
|
16
|
+
const withBoundaries = string_
|
|
17
|
+
.replaceAll(/([\p{Ll}\p{N}])(\p{Lu})/gu, "$1 $2")
|
|
18
|
+
.replaceAll(/(\p{Lu})(\p{Lu}\p{Ll})/gu, "$1 $2");
|
|
19
|
+
return withBoundaries.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.js","sourceRoot":"","sources":["../../src/String/words.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,OAAgB,EAAY,EAAE;IACnE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,cAAc,GAAG,OAAO;SAC3B,UAAU,CAAC,2BAA2B,EAAE,OAAO,CAAC;SAChD,UAAU,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* pipeline(); // 1
|
|
8
8
|
* pipeline((x) => x + 1)(); // 2
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
((
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export function createPipeline(initialValue) {
|
|
11
|
+
function pipeline(transformer) {
|
|
12
|
+
return transformer
|
|
13
|
+
? createPipeline(transformer(initialValue))
|
|
14
|
+
: initialValue;
|
|
15
|
+
}
|
|
16
|
+
return pipeline;
|
|
17
|
+
}
|
|
16
18
|
//# sourceMappingURL=createPipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/Tool/createPipeline.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/Tool/createPipeline.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAI,YAAe;IAG/C,SAAS,QAAQ,CAAI,WAA6B;QAChD,OAAO,WAAW;YAChB,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC3C,CAAC,CAAC,YAAY,CAAC;IACnB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/module/Tool/pipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../src/Tool/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,IAAI;IAIc;IAH7B;;OAEG;IACH,YAA6B,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;IAEzC;;;;OAIG;IACH,GAAG,CAAI,SAA0B;QAC/B,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CACF,SAAgC,EAChC,SAA0B;QAE1B,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../src/Tool/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,IAAI;IAIc;IAH7B;;OAEG;IACH,YAA6B,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;IAEzC;;;;OAIG;IACH,GAAG,CAAI,SAA0B;QAC/B,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CACF,SAAgC,EAChC,SAA0B;QAE1B,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAA6B;QAC/B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CAAc,SAAmC;QAC3D,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;OAMG;IACH,iBAAiB,CACf,SAAmC,EACnC,YAAe;QAEf,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YACtB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,YAAY,CACV,SAAmC;QAEnC,OAAO,IAAI,IAAI,CACb,WAAW,CAAO,GAAG,EAAE;YACrB,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,IAAI,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAI,YAAe;IACrC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC"}
|
package/module/URL/buildUrl.d.ts
CHANGED
|
@@ -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" });
|
package/module/URL/buildUrl.js
CHANGED
|
@@ -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" });
|
|
@@ -17,10 +27,6 @@
|
|
|
17
27
|
export const buildUrl = (base, parameters = {}) => {
|
|
18
28
|
const url = new URL(base);
|
|
19
29
|
for (const key of Object.keys(parameters)) {
|
|
20
|
-
// Prevent prototype pollution by rejecting dangerous keys
|
|
21
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
30
|
url.searchParams.append(key, parameters[key]);
|
|
25
31
|
}
|
|
26
32
|
return url.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrl.js","sourceRoot":"","sources":["../../src/URL/buildUrl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"buildUrl.js","sourceRoot":"","sources":["../../src/URL/buildUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAY,EACZ,aAAqC,EAAE,EAC/B,EAAE;IACV,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -27,10 +33,6 @@ export const parseQueryString = (query) => {
|
|
|
27
33
|
const parameters = new URLSearchParams(searchString);
|
|
28
34
|
const result = {};
|
|
29
35
|
for (const [key, value] of parameters) {
|
|
30
|
-
// Prevent prototype pollution by rejecting dangerous keys
|
|
31
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
36
|
result[key] = value;
|
|
35
37
|
}
|
|
36
38
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseQueryString.js","sourceRoot":"","sources":["../../src/URL/parseQueryString.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parseQueryString.js","sourceRoot":"","sources":["../../src/URL/parseQueryString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA0B,EAAE;IACxE,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isNumber.js","sourceRoot":"","sources":["../../src/Validate/isNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,CACf,MAAe,EACf,QAAW,IAAS,EACiC,EAAE;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK;QAC5D,CAAC,CAAC,wDAAwD;YACxD,QAAQ,CAAC,MAAgB,CAAC;QAC5B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"isNumber.js","sourceRoot":"","sources":["../../src/Validate/isNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,CACf,MAAe,EACf,QAAW,IAAS,EACiC,EAAE;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK;QAC5D,CAAC,CAAC,wDAAwD;YACxD,QAAQ,CAAC,MAAgB,CAAC;QAC5B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/object/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CASpB,SAAY,EAAO,EACnB,OAAgB,EAChB,EAAE;IACF,OAAO,CACL,KAKC,EAMA,EAAE;QACH,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/object/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CASpB,SAAY,EAAO,EACnB,OAAgB,EAChB,EAAE;IACF,OAAO,CACL,KAKC,EAMA,EAAE;QACH,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;YAC9B,6EAA6E;YAC7E,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAE,KAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACzD,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,6EAA6E;oBAC7E,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAY,CAAC,CAAC,OAAO;oBAC/C,kGAAkG;oBAClG,IAAI,EAAE,KAAY;iBACnB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,kGAAkG;YAClG,IAAI,EAAE,KAAY;SACnB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/object/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/object/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -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)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAA4D,EAG5D,EAAE;QACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAKD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,KAEL;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAEL;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -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,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps a validator to accept null values
|
|
3
|
+
* @template T - The type of value the wrapped validator expects
|
|
4
|
+
* @param {Function} validator - Validator function to make nullable
|
|
5
|
+
* @returns {Function} - Validator that passes for null or delegates to the wrapped validator
|
|
6
|
+
*/
|
|
7
|
+
export const nullable = (validator) => {
|
|
8
|
+
const nullableValidator = (value) => {
|
|
9
|
+
if (value === null) {
|
|
10
|
+
return {
|
|
11
|
+
validate: true,
|
|
12
|
+
message: "",
|
|
13
|
+
type: "null",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const result = validator(value);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
return nullableValidator;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=nullable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../src/Validate/object/nullable.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,SAAkD,EACO,EAAE;IAC3D,MAAM,iBAAiB,GAAG,CACxB,KAAe,EACmB,EAAE;QACpC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -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)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAAuC,EACmB,EAAE;QAC5D,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,KAA2D;iBAClE,CAAC;YACJ,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,KAA2D;SAClE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
@@ -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]>;
|