umt 2.4.0 → 2.6.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 +288 -16
- package/module/Array/generateNumberArray.js +13 -7
- package/module/Array/generateNumberArray.js.map +1 -1
- package/module/Array/getArraysCommon.js +21 -3
- package/module/Array/getArraysCommon.js.map +1 -1
- package/module/Array/groupBy.js +8 -7
- package/module/Array/groupBy.js.map +1 -1
- package/module/Array/index.d.ts +3 -0
- package/module/Array/index.js +3 -0
- package/module/Array/index.js.map +1 -1
- package/module/Array/timSort.js +2 -20
- package/module/Array/timSort.js.map +1 -1
- package/module/Array/ultraNumberSort.d.ts +7 -0
- package/module/Array/ultraNumberSort.js +373 -0
- package/module/Array/ultraNumberSort.js.map +1 -0
- package/module/Array/uniqBy.d.ts +7 -0
- package/module/Array/uniqBy.js +19 -0
- package/module/Array/uniqBy.js.map +1 -0
- package/module/Array/unique.d.ts +6 -0
- package/module/Array/unique.js +9 -0
- package/module/Array/unique.js.map +1 -0
- package/module/Color/rgbaToHsla.js +1 -1
- package/module/Color/rgbaToHsla.js.map +1 -1
- package/module/Date/birthday.js +14 -6
- package/module/Date/birthday.js.map +1 -1
- package/module/Date/isLeapYear.js +3 -0
- package/module/Date/isLeapYear.js.map +1 -1
- package/module/Error/index.d.ts +1 -0
- package/module/Error/index.js +1 -0
- package/module/Error/index.js.map +1 -1
- package/module/Error/retry.d.ts +37 -0
- package/module/Error/retry.js +47 -0
- package/module/Error/retry.js.map +1 -0
- package/module/IP/getIpClass.js +1 -1
- package/module/IP/getIpClass.js.map +1 -1
- package/module/IP/getNetworkAddress.js +2 -2
- package/module/IP/getNetworkAddress.js.map +1 -1
- package/module/IP/ipToBinaryString.js +2 -2
- package/module/IP/ipToBinaryString.js.map +1 -1
- package/module/IP/subnetMaskToCidr.js +1 -1
- package/module/IP/subnetMaskToCidr.js.map +1 -1
- package/module/Math/calculator/core.js +21 -13
- package/module/Math/calculator/core.js.map +1 -1
- package/module/Math/calculator/literalExpression.js +19 -7
- package/module/Math/calculator/literalExpression.js.map +1 -1
- package/module/Math/division.js +3 -3
- package/module/Math/division.js.map +1 -1
- package/module/Math/gcd.js +26 -4
- package/module/Math/gcd.js.map +1 -1
- package/module/Math/standardDeviation.js +4 -2
- package/module/Math/standardDeviation.js.map +1 -1
- package/module/Object/has.js +1 -2
- package/module/Object/has.js.map +1 -1
- package/module/Object/index.d.ts +4 -0
- package/module/Object/index.js +4 -0
- package/module/Object/index.js.map +1 -1
- package/module/Object/isEmpty.d.ts +6 -0
- package/module/Object/isEmpty.js +20 -0
- package/module/Object/isEmpty.js.map +1 -0
- package/module/Object/merge.d.ts +8 -0
- package/module/Object/merge.js +10 -0
- package/module/Object/merge.js.map +1 -0
- package/module/Object/mergeDeep.d.ts +8 -0
- package/module/Object/mergeDeep.js +37 -0
- package/module/Object/mergeDeep.js.map +1 -0
- package/module/Object/omit.d.ts +7 -0
- package/module/Object/omit.js +14 -0
- package/module/Object/omit.js.map +1 -0
- package/module/Object/pickDeep.d.ts +2 -2
- package/module/Object/pickDeep.js +4 -4
- package/module/Object/pickDeep.js.map +1 -1
- package/module/Simple/Date/dayOfWeekSimple.js +3 -3
- package/module/Simple/Date/dayOfWeekSimple.js.map +1 -1
- package/module/String/camelCase.d.ts +6 -0
- package/module/String/camelCase.js +12 -0
- package/module/String/camelCase.js.map +1 -0
- package/module/String/escapeHtml.d.ts +6 -0
- package/module/String/escapeHtml.js +19 -0
- package/module/String/escapeHtml.js.map +1 -0
- package/module/String/formatString/applyFormatter.d.ts +25 -0
- package/module/String/formatString/applyFormatter.js +71 -0
- package/module/String/formatString/applyFormatter.js.map +1 -0
- package/module/String/formatString/defaultFormatters.d.ts +24 -0
- package/module/String/formatString/defaultFormatters.js +59 -0
- package/module/String/formatString/defaultFormatters.js.map +1 -0
- package/module/String/formatString/detectMode.d.ts +26 -0
- package/module/String/formatString/detectMode.js +61 -0
- package/module/String/formatString/detectMode.js.map +1 -0
- package/module/String/formatString/getValue.d.ts +27 -0
- package/module/String/formatString/getValue.js +56 -0
- package/module/String/formatString/getValue.js.map +1 -0
- package/module/String/formatString/index.d.ts +91 -0
- package/module/String/formatString/index.js +38 -0
- package/module/String/formatString/index.js.map +1 -0
- package/module/String/index.d.ts +5 -0
- package/module/String/index.js +5 -0
- package/module/String/index.js.map +1 -1
- package/module/String/kebabCase.d.ts +6 -0
- package/module/String/kebabCase.js +22 -0
- package/module/String/kebabCase.js.map +1 -0
- package/module/String/levenshteinDistance.d.ts +8 -0
- package/module/String/levenshteinDistance.js +38 -0
- package/module/String/levenshteinDistance.js.map +1 -0
- package/module/String/stringSimilarity.d.ts +8 -0
- package/module/String/stringSimilarity.js +23 -0
- package/module/String/stringSimilarity.js.map +1 -0
- package/module/Tool/pipe.d.ts +1 -1
- package/module/Tool/pipe.js.map +1 -1
- package/module/Validate/core/index.js +0 -1
- package/module/Validate/core/index.js.map +1 -1
- package/module/Validate/isDouble.js +1 -1
- package/module/Validate/isDouble.js.map +1 -1
- package/module/Validate/isNode.js +1 -0
- package/module/Validate/isNode.js.map +1 -1
- package/module/Validate/isNumber.js +1 -1
- package/module/Validate/isNumber.js.map +1 -1
- package/module/Validate/isValueNaN.js +1 -1
- package/module/Validate/isValueNaN.js.map +1 -1
- package/module/Validate/number/even.js +7 -1
- package/module/Validate/number/even.js.map +1 -1
- package/module/Validate/number/odd.js +7 -1
- package/module/Validate/number/odd.js.map +1 -1
- package/module/Validate/string/email.js +20 -2
- package/module/Validate/string/email.js.map +1 -1
- package/module/es5/Array/generateNumberArray.js +15 -9
- package/module/es5/Array/getArraysCommon.js +39 -4
- package/module/es5/Array/groupBy.js +8 -7
- package/module/es5/Array/index.d.ts +3 -0
- package/module/es5/Array/index.js +33 -0
- package/module/es5/Array/timSort.js +2 -20
- package/module/es5/Array/ultraNumberSort.d.ts +7 -0
- package/module/es5/Array/ultraNumberSort.js +475 -0
- package/module/es5/Array/uniqBy.d.ts +7 -0
- package/module/es5/Array/uniqBy.js +36 -0
- package/module/es5/Array/unique.d.ts +6 -0
- package/module/es5/Array/unique.js +20 -0
- package/module/es5/Color/rgbaToHsla.js +1 -1
- package/module/es5/Date/birthday.js +17 -3
- package/module/es5/Date/isLeapYear.js +3 -0
- package/module/es5/Error/index.d.ts +1 -0
- package/module/es5/Error/index.js +11 -0
- package/module/es5/Error/retry.d.ts +37 -0
- package/module/es5/Error/retry.js +88 -0
- package/module/es5/IP/getIpClass.js +1 -1
- package/module/es5/IP/getNetworkAddress.js +2 -2
- package/module/es5/IP/ipToBinaryString.js +2 -2
- package/module/es5/IP/subnetMaskToCidr.js +1 -1
- package/module/es5/Math/calculator/core.js +17 -9
- package/module/es5/Math/calculator/literalExpression.js +19 -6
- package/module/es5/Math/division.js +3 -3
- package/module/es5/Math/gcd.js +43 -5
- package/module/es5/Math/standardDeviation.js +4 -2
- package/module/es5/Object/has.js +1 -1
- package/module/es5/Object/index.d.ts +4 -0
- package/module/es5/Object/index.js +44 -0
- package/module/es5/Object/isEmpty.d.ts +6 -0
- package/module/es5/Object/isEmpty.js +26 -0
- package/module/es5/Object/merge.d.ts +8 -0
- package/module/es5/Object/merge.js +18 -0
- package/module/es5/Object/mergeDeep.d.ts +8 -0
- package/module/es5/Object/mergeDeep.js +46 -0
- package/module/es5/Object/omit.d.ts +7 -0
- package/module/es5/Object/omit.js +29 -0
- package/module/es5/Object/pickDeep.d.ts +2 -2
- package/module/es5/Object/pickDeep.js +4 -4
- package/module/es5/Simple/Date/dayOfWeekSimple.js +3 -3
- package/module/es5/String/camelCase.d.ts +6 -0
- package/module/es5/String/camelCase.js +18 -0
- package/module/es5/String/escapeHtml.d.ts +6 -0
- package/module/es5/String/escapeHtml.js +27 -0
- package/module/es5/String/formatString/applyFormatter.d.ts +25 -0
- package/module/es5/String/formatString/applyFormatter.js +100 -0
- package/module/es5/String/formatString/defaultFormatters.d.ts +24 -0
- package/module/es5/String/formatString/defaultFormatters.js +79 -0
- package/module/es5/String/formatString/detectMode.d.ts +26 -0
- package/module/es5/String/formatString/detectMode.js +60 -0
- package/module/es5/String/formatString/getValue.d.ts +27 -0
- package/module/es5/String/formatString/getValue.js +85 -0
- package/module/es5/String/formatString/index.d.ts +91 -0
- package/module/es5/String/formatString/index.js +152 -0
- package/module/es5/String/index.d.ts +5 -0
- package/module/es5/String/index.js +55 -0
- package/module/es5/String/kebabCase.d.ts +6 -0
- package/module/es5/String/kebabCase.js +26 -0
- package/module/es5/String/levenshteinDistance.d.ts +8 -0
- package/module/es5/String/levenshteinDistance.js +58 -0
- package/module/es5/String/stringSimilarity.d.ts +8 -0
- package/module/es5/String/stringSimilarity.js +30 -0
- package/module/es5/Tool/pipe.d.ts +1 -1
- package/module/es5/Validate/core/index.js +0 -1
- package/module/es5/Validate/isDouble.js +1 -1
- package/module/es5/Validate/isNode.js +1 -0
- package/module/es5/Validate/isNumber.js +1 -1
- package/module/es5/Validate/isValueNaN.js +1 -1
- package/module/es5/Validate/number/even.js +4 -0
- package/module/es5/Validate/number/odd.js +4 -0
- package/module/es5/Validate/string/email.js +26 -1
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/module/es5/types/index.d.ts +1 -0
- package/module/es5/types/index.js +11 -0
- package/module/es5/types/logic/deepPartial.d.ts +37 -0
- package/module/es5/types/logic/deepPartial.js +5 -0
- package/module/es5/types/logic/deepRequired.d.ts +37 -0
- package/module/es5/types/logic/deepRequired.js +5 -0
- package/module/es5/types/logic/index.d.ts +3 -0
- package/module/es5/types/logic/index.js +33 -0
- package/module/es5/types/logic/unionToIntersection.d.ts +12 -0
- package/module/es5/types/logic/unionToIntersection.js +5 -0
- package/module/es5/types/object/index.d.ts +1 -0
- package/module/es5/types/object/index.js +11 -0
- package/module/es5/types/object/pickDeep.d.ts +13 -1
- package/module/es5/types/object/shallowObjectValue.d.ts +9 -0
- package/module/es5/types/object/shallowObjectValue.js +5 -0
- package/module/es5/types/string/formatString/formatData.d.ts +17 -0
- package/module/es5/types/string/formatString/formatData.js +5 -0
- package/module/es5/types/string/formatString/formatOptions.d.ts +21 -0
- package/module/es5/types/string/formatString/formatOptions.js +5 -0
- package/module/es5/types/string/formatString/formatString.d.ts +4 -0
- package/module/es5/types/string/formatString/formatString.js +49 -0
- package/module/es5/types/string/formatString/formatValue.d.ts +15 -0
- package/module/es5/types/string/formatString/formatValue.js +5 -0
- package/module/es5/types/string/formatString/formatter.d.ts +13 -0
- package/module/es5/types/string/formatString/formatter.js +5 -0
- package/module/es5/types/string/formatString/index.d.ts +5 -0
- package/module/es5/types/string/formatString/index.js +60 -0
- package/module/es5/types/string/index.d.ts +1 -0
- package/module/es5/types/string/index.js +16 -0
- package/module/types/index.d.ts +1 -0
- package/module/types/index.js +1 -0
- package/module/types/index.js.map +1 -1
- package/module/types/logic/deepPartial.d.ts +37 -0
- package/module/types/logic/deepPartial.js +36 -0
- package/module/types/logic/deepPartial.js.map +1 -0
- package/module/types/logic/deepRequired.d.ts +37 -0
- package/module/types/logic/deepRequired.js +2 -0
- package/module/types/logic/deepRequired.js.map +1 -0
- package/module/types/logic/index.d.ts +3 -0
- package/module/types/logic/index.js +3 -0
- package/module/types/logic/index.js.map +1 -1
- package/module/types/logic/unionToIntersection.d.ts +12 -0
- package/module/types/logic/unionToIntersection.js +2 -0
- package/module/types/logic/unionToIntersection.js.map +1 -0
- package/module/types/object/index.d.ts +1 -0
- package/module/types/object/index.js +1 -0
- package/module/types/object/index.js.map +1 -1
- package/module/types/object/pickDeep.d.ts +13 -1
- package/module/types/object/shallowObjectValue.d.ts +9 -0
- package/module/types/object/shallowObjectValue.js +2 -0
- package/module/types/object/shallowObjectValue.js.map +1 -0
- package/module/types/string/formatString/formatData.d.ts +17 -0
- package/module/types/string/formatString/formatData.js +2 -0
- package/module/types/string/formatString/formatData.js.map +1 -0
- package/module/types/string/formatString/formatOptions.d.ts +21 -0
- package/module/types/string/formatString/formatOptions.js +2 -0
- package/module/types/string/formatString/formatOptions.js.map +1 -0
- package/module/types/string/formatString/formatString.d.ts +4 -0
- package/module/types/string/formatString/formatString.js +5 -0
- package/module/types/string/formatString/formatString.js.map +1 -0
- package/module/types/string/formatString/formatValue.d.ts +15 -0
- package/module/types/string/formatString/formatValue.js +2 -0
- package/module/types/string/formatString/formatValue.js.map +1 -0
- package/module/types/string/formatString/formatter.d.ts +13 -0
- package/module/types/string/formatString/formatter.js +2 -0
- package/module/types/string/formatString/formatter.js.map +1 -0
- package/module/types/string/formatString/index.d.ts +5 -0
- package/module/types/string/formatString/index.js +6 -0
- package/module/types/string/formatString/index.js.map +1 -0
- package/module/types/string/index.d.ts +1 -0
- package/module/types/string/index.js +2 -0
- package/module/types/string/index.js.map +1 -0
- package/package.json +31 -32
- package/module/String/formatString.d.ts +0 -13
- package/module/String/formatString.js +0 -18
- package/module/String/formatString.js.map +0 -1
- package/module/es5/String/formatString.d.ts +0 -13
- package/module/es5/String/formatString.js +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/String/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
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,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,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to kebab-case
|
|
3
|
+
* @param str - The string to convert
|
|
4
|
+
* @returns The kebab-case string
|
|
5
|
+
*/
|
|
6
|
+
export const kebabCase = (string_) => {
|
|
7
|
+
return (string_
|
|
8
|
+
// Insert dash between lowercase and uppercase
|
|
9
|
+
.replaceAll(/([a-z])([A-Z])/g, "$1-$2")
|
|
10
|
+
// Insert dash between sequences of uppercase letters and following lowercase
|
|
11
|
+
.replaceAll(/([A-Z])([A-Z][a-z])/g, "$1-$2")
|
|
12
|
+
// Replace spaces and underscores with dashes
|
|
13
|
+
.replaceAll(/[\s_]+/g, "-")
|
|
14
|
+
// Remove special characters except alphanumeric and dashes
|
|
15
|
+
.replaceAll(/[^a-zA-Z0-9-]/g, "-")
|
|
16
|
+
// Remove multiple consecutive dashes
|
|
17
|
+
.replaceAll(/-+/g, "-")
|
|
18
|
+
// Remove leading and trailing dashes
|
|
19
|
+
.replaceAll(/^-|-$/g, "")
|
|
20
|
+
.toLowerCase());
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=kebabCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kebabCase.js","sourceRoot":"","sources":["../../src/String/kebabCase.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE;IACnD,OAAO,CACL,OAAO;QACL,8CAA8C;SAC7C,UAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC;QACvC,6EAA6E;SAC5E,UAAU,CAAC,sBAAsB,EAAE,OAAO,CAAC;QAC5C,6CAA6C;SAC5C,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC;QAC3B,2DAA2D;SAC1D,UAAU,CAAC,gBAAgB,EAAE,GAAG,CAAC;QAClC,qCAAqC;SACpC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;QACvB,qCAAqC;SACpC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxB,WAAW,EAAE,CACjB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the Levenshtein distance between two strings
|
|
3
|
+
* Returns the minimum number of single-character edits (insertions, deletions, or substitutions)
|
|
4
|
+
* @param str1 - First string to compare
|
|
5
|
+
* @param str2 - Second string to compare
|
|
6
|
+
* @returns The Levenshtein distance
|
|
7
|
+
*/
|
|
8
|
+
export declare const levenshteinDistance: (string1: string, string2: string) => number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the Levenshtein distance between two strings
|
|
3
|
+
* Returns the minimum number of single-character edits (insertions, deletions, or substitutions)
|
|
4
|
+
* @param str1 - First string to compare
|
|
5
|
+
* @param str2 - Second string to compare
|
|
6
|
+
* @returns The Levenshtein distance
|
|
7
|
+
*/
|
|
8
|
+
export const levenshteinDistance = (string1, string2) => {
|
|
9
|
+
const length1 = string1.length;
|
|
10
|
+
const length2 = string2.length;
|
|
11
|
+
// Return the length of the other string if one is empty
|
|
12
|
+
if (length1 === 0) {
|
|
13
|
+
return length2;
|
|
14
|
+
}
|
|
15
|
+
if (length2 === 0) {
|
|
16
|
+
return length1;
|
|
17
|
+
}
|
|
18
|
+
// Create a 2D array for dynamic programming
|
|
19
|
+
const matrix = Array.from({ length: length1 + 1 }, () => Array.from({ length: length2 + 1 }, () => 0));
|
|
20
|
+
// Initialize first column and row
|
|
21
|
+
for (let index = 0; index <= length1; index++) {
|
|
22
|
+
matrix[index][0] = index;
|
|
23
|
+
}
|
|
24
|
+
for (let index = 0; index <= length2; index++) {
|
|
25
|
+
matrix[0][index] = index;
|
|
26
|
+
}
|
|
27
|
+
// Calculate distances
|
|
28
|
+
for (let index = 1; index <= length1; index++) {
|
|
29
|
+
for (let index_ = 1; index_ <= length2; index_++) {
|
|
30
|
+
const cost = string1[index - 1] === string2[index_ - 1] ? 0 : 1;
|
|
31
|
+
matrix[index][index_] = Math.min(matrix[index - 1][index_] + 1, // deletion
|
|
32
|
+
matrix[index][index_ - 1] + 1, // insertion
|
|
33
|
+
matrix[index - 1][index_ - 1] + cost);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return matrix[length1][length2];
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=levenshteinDistance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levenshteinDistance.js","sourceRoot":"","sources":["../../src/String/levenshteinDistance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAe,EACf,OAAe,EACP,EAAE;IACV,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAE/B,wDAAwD;IACxD,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,4CAA4C;IAC5C,MAAM,MAAM,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAClE,KAAK,CAAC,IAAI,C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AAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the similarity between two strings as a percentage
|
|
3
|
+
* Uses Levenshtein distance normalized by the length of the longer string
|
|
4
|
+
* @param str1 - First string to compare
|
|
5
|
+
* @param str2 - Second string to compare
|
|
6
|
+
* @returns Similarity score between 0 (completely different) and 1 (identical)
|
|
7
|
+
*/
|
|
8
|
+
export declare const stringSimilarity: (string1: string, string2: string) => number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { levenshteinDistance } from "./levenshteinDistance";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the similarity between two strings as a percentage
|
|
4
|
+
* Uses Levenshtein distance normalized by the length of the longer string
|
|
5
|
+
* @param str1 - First string to compare
|
|
6
|
+
* @param str2 - Second string to compare
|
|
7
|
+
* @returns Similarity score between 0 (completely different) and 1 (identical)
|
|
8
|
+
*/
|
|
9
|
+
export const stringSimilarity = (string1, string2) => {
|
|
10
|
+
// Identical strings have 100% similarity
|
|
11
|
+
if (string1 === string2) {
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
// Empty strings handling
|
|
15
|
+
if (string1.length === 0 || string2.length === 0) {
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
const distance = levenshteinDistance(string1, string2);
|
|
19
|
+
const maxLength = Math.max(string1.length, string2.length);
|
|
20
|
+
// Calculate similarity as 1 - (distance / maxLength)
|
|
21
|
+
return 1 - distance / maxLength;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=stringSimilarity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringSimilarity.js","sourceRoot":"","sources":["../../src/String/stringSimilarity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAU,EAAE;IAC3E,yCAAyC;IACzC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,yBAAyB;IACzB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3D,qDAAqD;IACrD,OAAO,CAAC,GAAG,QAAQ,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC"}
|
package/module/Tool/pipe.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class Pipe<T> {
|
|
|
51
51
|
* @param predicate Condition function that determines if value should be filtered
|
|
52
52
|
* @returns New Pipe instance with Result containing filtered value or error
|
|
53
53
|
*/
|
|
54
|
-
filterResult<U extends T>(predicate: (input: T) => input is U): Pipe<Result<U,
|
|
54
|
+
filterResult<U extends T, E extends Error = Error>(predicate: (input: T) => input is U): Pipe<Result<U, E>>;
|
|
55
55
|
/**
|
|
56
56
|
* Terminates the pipeline and returns the final value
|
|
57
57
|
* @returns Final result of the pipeline processing
|
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,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AsC,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"}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
* @returns {Function} - A validator function that accepts a value, options, and message
|
|
10
10
|
*/
|
|
11
11
|
export const core = (type) => (value, option = [], message) => {
|
|
12
|
-
// biome-ignore lint/suspicious/useValidTypeof: Type parameter is a string literal type from Types<T>
|
|
13
12
|
if (typeof value !== type) {
|
|
14
13
|
return {
|
|
15
14
|
validate: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,IAAI,GACf,CAAI,IAAc,EAAE,EAAE,CACtB,CACE,KAAQ,EACR,SAAY,EAAkB,EAC9B,OAAgB,EACW,EAAE;IAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,IAAI,GACf,CAAI,IAAc,EAAE,EAAE,CACtB,CACE,KAAQ,EACR,SAAY,EAAkB,EAC9B,OAAgB,EACW,EAAE;IAC7B,IAAI,OAAO,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1B,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,IAAI;SACL,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE;gBAC/B,IAAI;aACL,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,IAAI;KACL,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const isDouble = (x, loose = true) => {
|
|
11
11
|
if (loose) {
|
|
12
12
|
return (
|
|
13
|
-
// biome-ignore lint/suspicious/noGlobalIsFinite:
|
|
13
|
+
// biome-ignore lint/suspicious/noGlobalIsFinite: ignore
|
|
14
14
|
isFinite(x) &&
|
|
15
15
|
!Number.isNaN(x) &&
|
|
16
16
|
Number.isFinite(Number(x)) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDouble.js","sourceRoot":"","sources":["../../src/Validate/isDouble.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,QAAQ,GAAG,CACf,CAAU,EACV,QAAW,IAAS,EAC4B,EAAE;IAClD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;QACL
|
|
1
|
+
{"version":3,"file":"isDouble.js","sourceRoot":"","sources":["../../src/Validate/isDouble.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,QAAQ,GAAG,CACf,CAAU,EACV,QAAW,IAAS,EAC4B,EAAE;IAClD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;QACL,wDAAwD;QACxD,QAAQ,CAAC,CAAW,CAAC;YACrB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAChB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isNode.js","sourceRoot":"","sources":["../../src/Validate/isNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACzB,IAAI,CAAC;QACH,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"isNode.js","sourceRoot":"","sources":["../../src/Validate/isNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACzB,IAAI,CAAC;QACH,oDAAoD;QACpD,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -15,7 +15,7 @@ const isNumber = (number, loose = true) => {
|
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
return number !== null && typeof number !== "boolean" && loose
|
|
18
|
-
? // biome-ignore lint/suspicious/noGlobalIsFinite:
|
|
18
|
+
? // biome-ignore lint/suspicious/noGlobalIsFinite: ignore
|
|
19
19
|
isFinite(number)
|
|
20
20
|
: Number.isFinite(number);
|
|
21
21
|
};
|
|
@@ -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
|
|
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,MAAgB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* isValueNaN(parseInt("not a number")); // true
|
|
11
11
|
*/
|
|
12
12
|
export const isValueNaN = (value, loose = false) => {
|
|
13
|
-
// biome-ignore lint/suspicious/noGlobalIsNan:
|
|
13
|
+
// biome-ignore lint/suspicious/noGlobalIsNan: ignore
|
|
14
14
|
return loose ? isNaN(value) : Number.isNaN(value);
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=isValueNaN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValueNaN.js","sourceRoot":"","sources":["../../src/Validate/isValueNaN.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,KAAK,GAAG,KAAK,EAAW,EAAE;IACnE,
|
|
1
|
+
{"version":3,"file":"isValueNaN.js","sourceRoot":"","sources":["../../src/Validate/isValueNaN.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,KAAK,GAAG,KAAK,EAAW,EAAE;IACnE,qDAAqD;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Number validation module for even numbers
|
|
3
3
|
* Provides validation functionality for checking if a number is even
|
|
4
4
|
*/
|
|
5
|
+
import { isDouble } from "../../Validate/isDouble";
|
|
5
6
|
/**
|
|
6
7
|
* Creates a validator for checking if a number is even
|
|
7
8
|
* @param {string} [message] - Custom error message for validation failure
|
|
@@ -11,7 +12,12 @@ export const even = (message) => {
|
|
|
11
12
|
return {
|
|
12
13
|
type: "number",
|
|
13
14
|
message,
|
|
14
|
-
validate: (value) =>
|
|
15
|
+
validate: (value) => {
|
|
16
|
+
if (isDouble(value, false)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return value % 2 === 0;
|
|
20
|
+
},
|
|
15
21
|
};
|
|
16
22
|
};
|
|
17
23
|
//# sourceMappingURL=even.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"even.js","sourceRoot":"","sources":["../../../src/Validate/number/even.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"even.js","sourceRoot":"","sources":["../../../src/Validate/number/even.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAgB,EAA8B,EAAE;IACnE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC3B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { isDouble } from "../../Validate/isDouble";
|
|
1
2
|
export const odd = (message) => {
|
|
2
3
|
return {
|
|
3
4
|
type: "number",
|
|
4
5
|
message,
|
|
5
|
-
validate: (value) =>
|
|
6
|
+
validate: (value) => {
|
|
7
|
+
if (isDouble(value, false)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return value % 2 !== 0;
|
|
11
|
+
},
|
|
6
12
|
};
|
|
7
13
|
};
|
|
8
14
|
//# sourceMappingURL=odd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odd.js","sourceRoot":"","sources":["../../../src/Validate/number/odd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"odd.js","sourceRoot":"","sources":["../../../src/Validate/number/odd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAAgB,EAA8B,EAAE;IAClE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC3B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -9,11 +9,29 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const email = (message) => {
|
|
11
11
|
// Regular expression for email address validation
|
|
12
|
-
const emailRegex = /^[
|
|
12
|
+
const emailRegex = /^[a-zA-Z0-9]([a-zA-Z0-9._+-]*[a-zA-Z0-9])?@[a-zA-Z0-9]([a-zA-Z0-9.-]*[a-zA-Z0-9])?\.[a-zA-Z]{2,}$/;
|
|
13
13
|
return {
|
|
14
14
|
type: "string",
|
|
15
15
|
message,
|
|
16
|
-
validate: (value) =>
|
|
16
|
+
validate: (value) => {
|
|
17
|
+
// Check for consecutive dots
|
|
18
|
+
if (value.includes("..")) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// Check for leading/trailing dots in local part
|
|
22
|
+
const [localPart, domainPart] = value.split("@");
|
|
23
|
+
if (!(localPart && domainPart)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (localPart.startsWith(".") || localPart.endsWith(".")) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (domainPart.startsWith(".") || domainPart.endsWith(".")) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
// Use regex for final validation
|
|
33
|
+
return emailRegex.test(value);
|
|
34
|
+
},
|
|
17
35
|
};
|
|
18
36
|
};
|
|
19
37
|
//# sourceMappingURL=email.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../../src/Validate/string/email.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAgB,EAA8B,EAAE;IACpE,kDAAkD;IAClD,MAAM,UAAU,GACd,
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../../src/Validate/string/email.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAgB,EAA8B,EAAE;IACpE,kDAAkD;IAClD,MAAM,UAAU,GACd,mGAAmG,CAAC;IACtG,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,6BAA6B;YAC7B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,gDAAgD;YAChD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACjD,IAAI,CAAC,CAAC,SAAS,IAAI,UAAU,CAAC,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;YACD,iCAAiC;YACjC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.generateNumberArray = void 0;
|
|
7
|
+
var _addition = require("@/Math/addition");
|
|
8
|
+
var _division = require("@/Math/division");
|
|
9
|
+
var _multiplication = require("@/Math/multiplication");
|
|
10
|
+
var _subtract = require("@/Math/subtract");
|
|
7
11
|
/**
|
|
8
12
|
* Generates an array of numbers with the specified length
|
|
9
13
|
* @param length The length of the array
|
|
@@ -16,28 +20,30 @@ exports.generateNumberArray = void 0;
|
|
|
16
20
|
*/
|
|
17
21
|
var generateNumberArray = exports.generateNumberArray = function generateNumberArray(length) {
|
|
18
22
|
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
19
|
-
var max = arguments.length > 2
|
|
23
|
+
var max = arguments.length > 2 ? arguments[2] : undefined;
|
|
20
24
|
var random = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
21
|
-
|
|
25
|
+
var actualLength = Math.floor(length);
|
|
26
|
+
var actualMax = max !== null && max !== void 0 ? max : actualLength - 1;
|
|
27
|
+
if (actualLength <= 0) {
|
|
22
28
|
return [];
|
|
23
29
|
}
|
|
24
|
-
if (min >
|
|
30
|
+
if (min > actualMax) {
|
|
25
31
|
throw new Error("min should be less than or equal to max");
|
|
26
32
|
}
|
|
27
|
-
if (
|
|
33
|
+
if (actualLength === 1) {
|
|
28
34
|
return [min];
|
|
29
35
|
}
|
|
30
36
|
if (random) {
|
|
31
37
|
return Array.from({
|
|
32
|
-
length:
|
|
38
|
+
length: actualLength
|
|
33
39
|
}, function () {
|
|
34
|
-
return Math.floor(Math.random()
|
|
40
|
+
return (0, _addition.addition)(Math.floor((0, _multiplication.multiplication)(Math.random(), (0, _addition.addition)((0, _subtract.subtract)(actualMax, min), 1))), min);
|
|
35
41
|
});
|
|
36
42
|
}
|
|
37
|
-
var step = (
|
|
43
|
+
var step = (0, _division.division)((0, _subtract.subtract)(actualMax, min), (0, _subtract.subtract)(actualLength, 1));
|
|
38
44
|
return Array.from({
|
|
39
|
-
length:
|
|
45
|
+
length: actualLength
|
|
40
46
|
}, function (_, index) {
|
|
41
|
-
return min
|
|
47
|
+
return (0, _addition.addition)(min, (0, _multiplication.multiplication)(index, step));
|
|
42
48
|
});
|
|
43
49
|
};
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getArraysCommon = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
10
|
/**
|
|
8
11
|
* Extract common elements from multiple arrays
|
|
9
12
|
* @param {T[]} array The first array
|
|
@@ -15,10 +18,42 @@ var getArraysCommon = exports.getArraysCommon = function getArraysCommon(array)
|
|
|
15
18
|
for (var _len = arguments.length, arrays = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
16
19
|
arrays[_key - 1] = arguments[_key];
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
+
if (arrays.length === 0) {
|
|
22
|
+
return array;
|
|
23
|
+
}
|
|
24
|
+
var result = array.filter(function (item) {
|
|
25
|
+
// Handle NaN specially since NaN !== NaN
|
|
26
|
+
if (Number.isNaN(item)) {
|
|
27
|
+
return arrays.every(function (currentArray) {
|
|
28
|
+
return currentArray.some(function (arrayItem) {
|
|
29
|
+
return Number.isNaN(arrayItem);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return arrays.every(function (currentArray) {
|
|
34
|
+
return currentArray.includes(item);
|
|
21
35
|
});
|
|
22
36
|
});
|
|
23
|
-
|
|
37
|
+
var uniqueResult = [];
|
|
38
|
+
var _iterator = _createForOfIteratorHelper(result),
|
|
39
|
+
_step;
|
|
40
|
+
try {
|
|
41
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
42
|
+
var item = _step.value;
|
|
43
|
+
if (Number.isNaN(item)) {
|
|
44
|
+
if (!uniqueResult.some(function (existing) {
|
|
45
|
+
return Number.isNaN(existing);
|
|
46
|
+
})) {
|
|
47
|
+
uniqueResult.push(item);
|
|
48
|
+
}
|
|
49
|
+
} else if (!uniqueResult.includes(item)) {
|
|
50
|
+
uniqueResult.push(item);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
_iterator.e(err);
|
|
55
|
+
} finally {
|
|
56
|
+
_iterator.f();
|
|
57
|
+
}
|
|
58
|
+
return uniqueResult;
|
|
24
59
|
};
|
|
@@ -15,12 +15,13 @@ exports.groupBy = void 0;
|
|
|
15
15
|
* groupBy(["apple", "banana", "carrot"], (str) => str[0]); // { 'a': ['apple'], 'b': ['banana'], 'c': ['carrot'] }
|
|
16
16
|
*/
|
|
17
17
|
var groupBy = exports.groupBy = function groupBy(array, iteratee) {
|
|
18
|
-
|
|
18
|
+
var result = Object.create(null);
|
|
19
|
+
var length = array.length;
|
|
20
|
+
for (var index = 0; index < length; index++) {
|
|
21
|
+
var value = array[index];
|
|
19
22
|
var key = iteratee(value, index, array);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return accumulator;
|
|
25
|
-
}, {});
|
|
23
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: ignore
|
|
24
|
+
(result[key] || (result[key] = [])).push(value);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
26
27
|
};
|
|
@@ -20,5 +20,8 @@ export * from "./shuffle";
|
|
|
20
20
|
export * from "./shuffle2DArray";
|
|
21
21
|
export * from "./sum";
|
|
22
22
|
export * from "./timSort";
|
|
23
|
+
export * from "./ultraNumberSort";
|
|
24
|
+
export * from "./uniqBy";
|
|
25
|
+
export * from "./unique";
|
|
23
26
|
export * from "./zip";
|
|
24
27
|
export * from "./zipLongest";
|
|
@@ -245,6 +245,39 @@ Object.keys(_timSort).forEach(function (key) {
|
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
+
var _ultraNumberSort = require("./ultraNumberSort");
|
|
249
|
+
Object.keys(_ultraNumberSort).forEach(function (key) {
|
|
250
|
+
if (key === "default" || key === "__esModule") return;
|
|
251
|
+
if (key in exports && exports[key] === _ultraNumberSort[key]) return;
|
|
252
|
+
Object.defineProperty(exports, key, {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function get() {
|
|
255
|
+
return _ultraNumberSort[key];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
var _uniqBy = require("./uniqBy");
|
|
260
|
+
Object.keys(_uniqBy).forEach(function (key) {
|
|
261
|
+
if (key === "default" || key === "__esModule") return;
|
|
262
|
+
if (key in exports && exports[key] === _uniqBy[key]) return;
|
|
263
|
+
Object.defineProperty(exports, key, {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function get() {
|
|
266
|
+
return _uniqBy[key];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
var _unique = require("./unique");
|
|
271
|
+
Object.keys(_unique).forEach(function (key) {
|
|
272
|
+
if (key === "default" || key === "__esModule") return;
|
|
273
|
+
if (key in exports && exports[key] === _unique[key]) return;
|
|
274
|
+
Object.defineProperty(exports, key, {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function get() {
|
|
277
|
+
return _unique[key];
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
});
|
|
248
281
|
var _zip = require("./zip");
|
|
249
282
|
Object.keys(_zip).forEach(function (key) {
|
|
250
283
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -5,27 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.timSort = void 0;
|
|
7
7
|
var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
8
|
+
var _insertionSort = require("@/Array/insertionSort");
|
|
8
9
|
var MIN_RUN = 32;
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Sorts a portion of the array using insertion sort algorithm
|
|
12
|
-
* @param array Array to sort
|
|
13
|
-
* @param start Starting index of the range to sort
|
|
14
|
-
* @param end Ending index of the range to sort
|
|
15
|
-
* @param compareFunction Function to compare elements
|
|
16
|
-
*/
|
|
17
|
-
var insertionSort = function insertionSort(array, start, end, compareFunction) {
|
|
18
|
-
for (var index = start + 1; index <= end; index++) {
|
|
19
|
-
var temporary = array[index];
|
|
20
|
-
var currentIndex = index - 1;
|
|
21
|
-
while (currentIndex >= start && compareFunction(array[currentIndex], temporary) > 0) {
|
|
22
|
-
array[currentIndex + 1] = array[currentIndex];
|
|
23
|
-
currentIndex--;
|
|
24
|
-
}
|
|
25
|
-
array[currentIndex + 1] = temporary;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
11
|
/**
|
|
30
12
|
* Merges two sorted portions of the array
|
|
31
13
|
* @param array Array containing the portions to merge
|
|
@@ -100,7 +82,7 @@ var timSort = exports.timSort = function timSort(array) {
|
|
|
100
82
|
var n = end - start + 1;
|
|
101
83
|
var minRun = getMinRunLength(n);
|
|
102
84
|
for (var index = start; index <= end; index += minRun) {
|
|
103
|
-
insertionSort(array, index, Math.min(index + MIN_RUN - 1, end)
|
|
85
|
+
(0, _insertionSort.insertionSort)(array, compareFunction, index, Math.min(index + MIN_RUN - 1, end));
|
|
104
86
|
}
|
|
105
87
|
for (var size = minRun; size < n; size *= 2) {
|
|
106
88
|
for (var left = start; left <= end; left += 2 * size) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ultra-fast sorting specifically optimized for number arrays
|
|
3
|
+
* @param array Array of numbers to sort
|
|
4
|
+
* @param ascending Sort in ascending order if true, descending if false
|
|
5
|
+
* @returns Sorted array
|
|
6
|
+
*/
|
|
7
|
+
export declare const ultraNumberSort: (array: number[], ascending?: boolean) => number[];
|