umt 2.16.0 → 2.17.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 +42 -0
- 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/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/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 +30 -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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the minimum common leading whitespace from each line of the input.
|
|
3
|
+
* Works as a plain function or as a tagged template literal.
|
|
4
|
+
*
|
|
5
|
+
* @param {string | TemplateStringsArray} string_ - Input string or template strings array
|
|
6
|
+
* @param {...unknown[]} values - Interpolated values when used as a tag
|
|
7
|
+
* @returns {string} Dedented string
|
|
8
|
+
* @example
|
|
9
|
+
* dedent(`
|
|
10
|
+
* line1
|
|
11
|
+
* line2
|
|
12
|
+
* `); // "\nline1\n line2\n"
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* dedent`
|
|
16
|
+
* value: ${1}
|
|
17
|
+
* `; // "\nvalue: 1\n"
|
|
18
|
+
*/
|
|
19
|
+
export declare const dedent: (string_: string | TemplateStringsArray, ...values: unknown[]) => string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the minimum common leading whitespace from each line of the input.
|
|
3
|
+
* Works as a plain function or as a tagged template literal.
|
|
4
|
+
*
|
|
5
|
+
* @param {string | TemplateStringsArray} string_ - Input string or template strings array
|
|
6
|
+
* @param {...unknown[]} values - Interpolated values when used as a tag
|
|
7
|
+
* @returns {string} Dedented string
|
|
8
|
+
* @example
|
|
9
|
+
* dedent(`
|
|
10
|
+
* line1
|
|
11
|
+
* line2
|
|
12
|
+
* `); // "\nline1\n line2\n"
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* dedent`
|
|
16
|
+
* value: ${1}
|
|
17
|
+
* `; // "\nvalue: 1\n"
|
|
18
|
+
*/
|
|
19
|
+
export const dedent = (string_, ...values) => {
|
|
20
|
+
let raw;
|
|
21
|
+
if (typeof string_ === "string") {
|
|
22
|
+
raw = string_;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
let assembled = "";
|
|
26
|
+
let index = 0;
|
|
27
|
+
for (const part of string_) {
|
|
28
|
+
assembled += part;
|
|
29
|
+
if (index < values.length) {
|
|
30
|
+
assembled += String(values[index]);
|
|
31
|
+
}
|
|
32
|
+
index += 1;
|
|
33
|
+
}
|
|
34
|
+
raw = assembled;
|
|
35
|
+
}
|
|
36
|
+
const lines = raw.split("\n");
|
|
37
|
+
let minIndent = Number.POSITIVE_INFINITY;
|
|
38
|
+
for (const line of lines) {
|
|
39
|
+
if (line.trim().length === 0) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
let indent = 0;
|
|
43
|
+
while (indent < line.length &&
|
|
44
|
+
(line[indent] === " " || line[indent] === "\t")) {
|
|
45
|
+
indent += 1;
|
|
46
|
+
}
|
|
47
|
+
if (indent < minIndent) {
|
|
48
|
+
minIndent = indent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!Number.isFinite(minIndent)) {
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
54
|
+
return lines.map((line) => line.slice(minIndent)).join("\n");
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=dedent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedent.js","sourceRoot":"","sources":["../../src/String/dedent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,OAAsC,EACtC,GAAG,MAAiB,EACZ,EAAE;IACV,IAAI,GAAW,CAAC;IAChB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,GAAG,GAAG,OAAO,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,SAAS,IAAI,IAAI,CAAC;YAClB,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;gBAC1B,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrC,CAAC;YACD,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;QACD,GAAG,GAAG,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,SAAS;QACX,CAAC;QACD,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,OACE,MAAM,GAAG,IAAI,CAAC,MAAM;YACpB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,EAC/C,CAAC;YACD,MAAM,IAAI,CAAC,CAAC;QACd,CAAC;QACD,IAAI,MAAM,GAAG,SAAS,EAAE,CAAC;YACvB,SAAS,GAAG,MAAM,CAAC;QACrB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC,CAAC"}
|
package/module/String/index.d.ts
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,17 +10,24 @@ 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";
|
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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DebouncedAsyncFunction<A extends unknown[], R> {
|
|
2
|
+
(...arguments_: A): Promise<R>;
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Creates a debounced async function. Subsequent calls within `wait` ms reset
|
|
7
|
+
* the timer and share a single resolution; the latest arguments win.
|
|
8
|
+
*
|
|
9
|
+
* @template A - Argument tuple type
|
|
10
|
+
* @template R - Resolved value type
|
|
11
|
+
* @param {(...args: A) => Promise<R>} function_ - Async function to debounce
|
|
12
|
+
* @param {number} wait - Debounce window in milliseconds
|
|
13
|
+
* @returns {DebouncedAsyncFunction<A, R>} Debounced wrapper with cancel support
|
|
14
|
+
* @example
|
|
15
|
+
* const search = debounceAsync(query, 300);
|
|
16
|
+
* await search("foo");
|
|
17
|
+
*/
|
|
18
|
+
export declare const debounceAsync: <A extends unknown[], R>(function_: (...arguments_: A) => Promise<R>, wait: number) => DebouncedAsyncFunction<A, R>;
|