umt 2.10.1 → 2.12.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 +3 -2
- package/module/Advance/rangeAdvance.d.ts +1 -1
- package/module/Advance/rangeAdvance.js.map +1 -1
- package/module/Array/checkFlagAlignment.js +3 -0
- package/module/Array/checkFlagAlignment.js.map +1 -1
- package/module/Array/compact.js.map +1 -1
- package/module/Array/dualPivotQuickSort.js +4 -3
- package/module/Array/dualPivotQuickSort.js.map +1 -1
- package/module/Array/getArraysCommon.js +33 -12
- package/module/Array/getArraysCommon.js.map +1 -1
- package/module/Array/groupBy.js +1 -1
- package/module/Array/insertionSort.js +4 -10
- package/module/Array/insertionSort.js.map +1 -1
- package/module/Array/quickSort.js +4 -3
- package/module/Array/quickSort.js.map +1 -1
- package/module/Array/range.js +1 -1
- package/module/Array/range.js.map +1 -1
- package/module/Array/sortingHelpers/applyInsertionSortIfNeeded.js +2 -2
- package/module/Array/sortingHelpers/applyInsertionSortIfNeeded.js.map +1 -1
- package/module/Array/sortingHelpers/insertionSortRange.d.ts +5 -0
- package/module/Array/sortingHelpers/insertionSortRange.js +15 -0
- package/module/Array/sortingHelpers/insertionSortRange.js.map +1 -0
- package/module/Array/timSort.js +7 -5
- package/module/Array/timSort.js.map +1 -1
- package/module/Array/ultraNumberSort.js +18 -18
- package/module/Array/ultraNumberSort.js.map +1 -1
- package/module/Color/hexaToRgba.d.ts +1 -1
- package/module/Color/hexaToRgba.js +1 -1
- package/module/Consts/clock.d.ts +1 -1
- package/module/Consts/clock.js.map +1 -1
- package/module/Crypto/decodeBase58.js +4 -4
- package/module/Crypto/decodeBase58.js.map +1 -1
- package/module/Crypto/encodeBase58.js +4 -4
- package/module/Crypto/encodeBase58.js.map +1 -1
- package/module/DataStructure/priorityQueue.d.ts +4 -4
- package/module/DataStructure/priorityQueue.js +3 -2
- package/module/DataStructure/priorityQueue.js.map +1 -1
- package/module/Date/dayOfWeek.js +1 -1
- package/module/Date/format.js +1 -1
- package/module/IP/ipToBinaryString.js +1 -1
- 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 +15 -5
- package/module/Math/calculator/core.js.map +1 -1
- package/module/Math/gcd.js +5 -2
- package/module/Math/gcd.js.map +1 -1
- package/module/Math/mathConverter.js +1 -1
- package/module/Math/mathConverter.js.map +1 -1
- package/module/Math/mode.js +3 -2
- package/module/Math/mode.js.map +1 -1
- package/module/Math/nCr.js +4 -1
- package/module/Math/nCr.js.map +1 -1
- package/module/Math/nPr.js +4 -1
- package/module/Math/nPr.js.map +1 -1
- package/module/Math/primeFactorization.js +5 -1
- package/module/Math/primeFactorization.js.map +1 -1
- package/module/Math/reduce.js +4 -1
- package/module/Math/reduce.js.map +1 -1
- package/module/Math/solveEquation.js +1 -1
- package/module/Math/solveEquation.js.map +1 -1
- package/module/Math/uuidv7.js +11 -14
- package/module/Math/uuidv7.js.map +1 -1
- package/module/Object/mergeDeep.js.map +1 -1
- package/module/Object/omit.js +1 -0
- package/module/Object/omit.js.map +1 -1
- package/module/Object/pickDeep.js +1 -1
- package/module/String/formatString/applyFormatter.js +1 -1
- package/module/String/formatString/applyFormatter.js.map +1 -1
- package/module/String/formatString/getValue.js +1 -1
- package/module/String/formatString/getValue.js.map +1 -1
- package/module/String/fromBase64.js +2 -1
- package/module/String/fromBase64.js.map +1 -1
- package/module/String/fuzzySearch.d.ts +2 -2
- package/module/String/fuzzySearch.js +2 -1
- package/module/String/fuzzySearch.js.map +1 -1
- package/module/String/levenshteinDistance.d.ts +2 -2
- package/module/String/levenshteinDistance.js +28 -18
- package/module/String/levenshteinDistance.js.map +1 -1
- package/module/String/padStart.d.ts +0 -1
- package/module/String/padStart.js +2 -6
- package/module/String/padStart.js.map +1 -1
- package/module/String/reverseString.js +1 -1
- package/module/String/reverseString.js.map +1 -1
- package/module/Tool/index.d.ts +1 -0
- package/module/Tool/index.js +1 -0
- package/module/Tool/index.js.map +1 -1
- package/module/Tool/unwrap.d.ts +9 -0
- package/module/Tool/unwrap.js +15 -0
- package/module/Tool/unwrap.js.map +1 -0
- package/module/Validate/array/core.js +1 -1
- package/module/Validate/core/index.js +2 -2
- package/module/Validate/index.d.ts +1 -0
- package/module/Validate/index.js +1 -0
- package/module/Validate/index.js.map +1 -1
- package/module/Validate/isDeepEqual.js.map +1 -1
- package/module/Validate/object/core.js +1 -1
- package/module/Validate/parseEmail.d.ts +14 -0
- package/module/Validate/parseEmail.js +24 -0
- package/module/Validate/parseEmail.js.map +1 -0
- package/module/Validate/string/index.d.ts +1 -1
- package/module/Validate/string/index.js +1 -1
- package/module/Validate/string/index.js.map +1 -1
- package/module/Validate/string/uuid.js +10 -11
- package/module/Validate/string/uuid.js.map +1 -1
- package/module/Validate/string/{email.d.ts → validateEmail.d.ts} +2 -1
- package/module/Validate/string/validateEmail.js +23 -0
- package/module/Validate/string/validateEmail.js.map +1 -0
- package/module/es5/Advance/rangeAdvance.d.ts +1 -1
- package/module/es5/Array/checkFlagAlignment.js +3 -0
- package/module/es5/Array/dualPivotQuickSort.js +10 -3
- package/module/es5/Array/getArraysCommon.js +45 -19
- package/module/es5/Array/groupBy.js +2 -1
- package/module/es5/Array/insertionSort.js +10 -10
- package/module/es5/Array/quickSort.js +10 -3
- package/module/es5/Array/range.js +1 -1
- package/module/es5/Array/sortingHelpers/applyInsertionSortIfNeeded.js +2 -2
- package/module/es5/Array/sortingHelpers/insertionSortRange.d.ts +5 -0
- package/module/es5/Array/sortingHelpers/insertionSortRange.js +20 -0
- package/module/es5/Array/timSort.js +13 -5
- package/module/es5/Array/ultraNumberSort.js +38 -34
- package/module/es5/Color/hexaToRgba.d.ts +1 -1
- package/module/es5/Color/hexaToRgba.js +1 -1
- package/module/es5/Consts/clock.d.ts +1 -1
- package/module/es5/Crypto/decodeBase58.js +4 -4
- package/module/es5/Crypto/encodeBase58.js +4 -4
- package/module/es5/DataStructure/priorityQueue.d.ts +4 -4
- package/module/es5/DataStructure/priorityQueue.js +3 -2
- package/module/es5/Date/dayOfWeek.js +2 -1
- package/module/es5/Date/format.js +1 -1
- package/module/es5/IP/ipToBinaryString.js +1 -1
- package/module/es5/IP/subnetMaskToCidr.js +1 -1
- package/module/es5/Math/calculator/core.js +15 -5
- package/module/es5/Math/gcd.js +5 -2
- package/module/es5/Math/mathConverter.js +1 -1
- package/module/es5/Math/mode.js +4 -4
- package/module/es5/Math/nCr.js +4 -1
- package/module/es5/Math/nPr.js +4 -1
- package/module/es5/Math/primeFactorization.js +8 -1
- package/module/es5/Math/reduce.js +8 -1
- package/module/es5/Math/solveEquation.js +1 -1
- package/module/es5/Math/uuidv7.js +13 -14
- package/module/es5/Object/omit.js +1 -0
- package/module/es5/Object/pickDeep.js +2 -1
- package/module/es5/String/formatString/applyFormatter.js +1 -1
- package/module/es5/String/formatString/getValue.js +1 -1
- package/module/es5/String/formatString/index.js +1 -1
- package/module/es5/String/fromBase64.js +2 -1
- package/module/es5/String/fuzzySearch.d.ts +2 -2
- package/module/es5/String/fuzzySearch.js +2 -1
- package/module/es5/String/hasNoLetters.js +1 -1
- package/module/es5/String/levenshteinDistance.d.ts +2 -2
- package/module/es5/String/levenshteinDistance.js +33 -30
- package/module/es5/String/padStart.d.ts +0 -1
- package/module/es5/String/padStart.js +2 -7
- package/module/es5/String/reverseString.js +1 -1
- package/module/es5/Tool/index.d.ts +1 -0
- package/module/es5/Tool/index.js +11 -0
- package/module/es5/Tool/unwrap.d.ts +9 -0
- package/module/es5/Tool/unwrap.js +20 -0
- package/module/es5/Validate/array/core.js +1 -1
- package/module/es5/Validate/core/index.js +3 -2
- package/module/es5/Validate/index.d.ts +1 -0
- package/module/es5/Validate/index.js +11 -0
- package/module/es5/Validate/object/core.js +1 -1
- package/module/es5/Validate/parseEmail.d.ts +14 -0
- package/module/es5/Validate/parseEmail.js +48 -0
- package/module/es5/Validate/string/index.d.ts +1 -1
- package/module/es5/Validate/string/index.js +4 -4
- package/module/es5/Validate/string/uuid.js +7 -4
- package/module/es5/Validate/string/{email.d.ts → validateEmail.d.ts} +2 -1
- package/module/es5/Validate/string/validateEmail.js +31 -0
- package/module/es5/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -43
- package/module/Validate/string/email.js +0 -45
- package/module/Validate/string/email.js.map +0 -1
- package/module/es5/Validate/string/email.js +0 -62
|
@@ -5,6 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.insertionSort = void 0;
|
|
7
7
|
var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
8
|
+
var _insertionSortRange = require("./sortingHelpers/insertionSortRange");
|
|
9
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
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; } }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
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; }
|
|
8
15
|
/**
|
|
9
16
|
* Sort an array using insertion sort algorithm
|
|
10
17
|
*
|
|
@@ -30,14 +37,7 @@ var insertionSort = exports.insertionSort = function insertionSort(array) {
|
|
|
30
37
|
var compareFunction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _compareFunctionDefault.compareFunctionDefault;
|
|
31
38
|
var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
32
39
|
var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
while (index_ > start && compareFunction(array[index_ - 1], target) > 0) {
|
|
37
|
-
array[index_] = array[index_ - 1];
|
|
38
|
-
index_--;
|
|
39
|
-
}
|
|
40
|
-
array[index_] = target;
|
|
41
|
-
}
|
|
42
|
-
return array;
|
|
40
|
+
var result = _toConsumableArray(array);
|
|
41
|
+
(0, _insertionSortRange.insertionSortRange)(result, compareFunction, start, end);
|
|
42
|
+
return result;
|
|
43
43
|
};
|
|
@@ -7,6 +7,12 @@ exports.quickSort = void 0;
|
|
|
7
7
|
var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
8
8
|
var _applyInsertionSortIfNeeded = require("./sortingHelpers/applyInsertionSortIfNeeded");
|
|
9
9
|
var _rangeValidator = require("./sortingHelpers/rangeValidator");
|
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
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; } }
|
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
|
+
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; }
|
|
10
16
|
/**
|
|
11
17
|
* Finds the median value among three elements in the array
|
|
12
18
|
* @param array The array containing the elements
|
|
@@ -110,12 +116,13 @@ var quickSort = exports.quickSort = function quickSort(array) {
|
|
|
110
116
|
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
111
117
|
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1;
|
|
112
118
|
var insertionSortThreshold = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 10;
|
|
113
|
-
var
|
|
119
|
+
var result = _toConsumableArray(array);
|
|
120
|
+
var _validateRange = (0, _rangeValidator.validateRange)(result, startIndex, endIndex),
|
|
114
121
|
validStartIndex = _validateRange.startIndex,
|
|
115
122
|
validEndIndex = _validateRange.endIndex,
|
|
116
123
|
shouldSort = _validateRange.shouldSort;
|
|
117
124
|
if (shouldSort) {
|
|
118
|
-
_sortImpl(
|
|
125
|
+
_sortImpl(result, validStartIndex, validEndIndex, compareFunction, insertionSortThreshold);
|
|
119
126
|
}
|
|
120
|
-
return
|
|
127
|
+
return result;
|
|
121
128
|
};
|
|
@@ -22,7 +22,7 @@ var range = exports.range = function range(start, end) {
|
|
|
22
22
|
return array;
|
|
23
23
|
}
|
|
24
24
|
var actualStart = end === undefined ? 0 : start;
|
|
25
|
-
var actualEnd = end
|
|
25
|
+
var actualEnd = end !== null && end !== void 0 ? end : start;
|
|
26
26
|
|
|
27
27
|
// Return empty array if invalid range
|
|
28
28
|
if (step > 0 && actualStart >= actualEnd || step < 0 && actualStart <= actualEnd) {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.applyInsertionSortIfNeeded = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _insertionSortRange = require("./insertionSortRange");
|
|
8
8
|
/**
|
|
9
9
|
* Checks if a partition is small enough to apply insertion sort and applies it if so.
|
|
10
10
|
*
|
|
@@ -18,7 +18,7 @@ var _insertionSort = require("@/Array/insertionSort");
|
|
|
18
18
|
*/
|
|
19
19
|
var applyInsertionSortIfNeeded = exports.applyInsertionSortIfNeeded = function applyInsertionSortIfNeeded(array, low, high, compareFunction, insertionSortThreshold) {
|
|
20
20
|
if (high - low + 1 <= insertionSortThreshold) {
|
|
21
|
-
(0,
|
|
21
|
+
(0, _insertionSortRange.insertionSortRange)(array, compareFunction, low, high);
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
24
24
|
return false;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.insertionSortRange = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
var insertionSortRange = exports.insertionSortRange = function insertionSortRange(array, compareFunction, start, end) {
|
|
11
|
+
for (var index = start + 1; index <= end; index++) {
|
|
12
|
+
var index_ = index;
|
|
13
|
+
var target = array[index];
|
|
14
|
+
while (index_ > start && compareFunction(array[index_ - 1], target) > 0) {
|
|
15
|
+
array[index_] = array[index_ - 1];
|
|
16
|
+
index_--;
|
|
17
|
+
}
|
|
18
|
+
array[index_] = target;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -5,7 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.timSort = void 0;
|
|
7
7
|
var _compareFunctionDefault = require("./compareFunctionDefault");
|
|
8
|
-
var
|
|
8
|
+
var _insertionSortRange = require("./sortingHelpers/insertionSortRange");
|
|
9
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
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; } }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
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; }
|
|
9
15
|
var MIN_RUN = 32;
|
|
10
16
|
|
|
11
17
|
/**
|
|
@@ -79,19 +85,21 @@ var timSort = exports.timSort = function timSort(array) {
|
|
|
79
85
|
var compareFunction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _compareFunctionDefault.compareFunctionDefault;
|
|
80
86
|
var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
81
87
|
var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1;
|
|
88
|
+
var result = _toConsumableArray(array);
|
|
82
89
|
var n = end - start + 1;
|
|
83
90
|
var minRun = getMinRunLength(n);
|
|
84
|
-
for (var
|
|
85
|
-
|
|
91
|
+
for (var runStart = start; runStart <= end; runStart += minRun) {
|
|
92
|
+
var runEnd = Math.min(runStart + minRun - 1, end);
|
|
93
|
+
(0, _insertionSortRange.insertionSortRange)(result, compareFunction, runStart, runEnd);
|
|
86
94
|
}
|
|
87
95
|
for (var size = minRun; size < n; size *= 2) {
|
|
88
96
|
for (var left = start; left <= end; left += 2 * size) {
|
|
89
97
|
var mid = left + size - 1;
|
|
90
98
|
var right = Math.min(left + 2 * size - 1, end);
|
|
91
99
|
if (mid < right) {
|
|
92
|
-
merge(
|
|
100
|
+
merge(result, left, mid, right, compareFunction);
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
103
|
}
|
|
96
|
-
return
|
|
104
|
+
return result;
|
|
97
105
|
};
|
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ultraNumberSort = void 0;
|
|
7
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
10
|
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; } }
|
|
11
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
9
13
|
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; }
|
|
10
14
|
/**
|
|
11
15
|
* Ultra-fast sorting specifically optimized for number arrays
|
|
@@ -15,32 +19,33 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
15
19
|
*/
|
|
16
20
|
var ultraNumberSort = exports.ultraNumberSort = function ultraNumberSort(array) {
|
|
17
21
|
var ascending = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
18
|
-
var
|
|
22
|
+
var result = _toConsumableArray(array);
|
|
23
|
+
var length = result.length;
|
|
19
24
|
if (length <= 1) {
|
|
20
|
-
return
|
|
25
|
+
return result;
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
// For tiny arrays, use optimized inline sort
|
|
24
29
|
if (length === 2) {
|
|
25
|
-
if (
|
|
26
|
-
var _ref = [
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (result[0] > result[1] === ascending) {
|
|
31
|
+
var _ref = [result[1], result[0]];
|
|
32
|
+
result[0] = _ref[0];
|
|
33
|
+
result[1] = _ref[1];
|
|
29
34
|
}
|
|
30
|
-
return
|
|
35
|
+
return result;
|
|
31
36
|
}
|
|
32
37
|
if (length === 3) {
|
|
33
|
-
inlineSort3(
|
|
34
|
-
return
|
|
38
|
+
inlineSort3(result, ascending);
|
|
39
|
+
return result;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
// Check if all numbers are integers and find range
|
|
38
43
|
var allIntegers = true;
|
|
39
|
-
var min =
|
|
40
|
-
var max =
|
|
44
|
+
var min = result[0];
|
|
45
|
+
var max = result[0];
|
|
41
46
|
var hasNaN = false;
|
|
42
47
|
for (var index = 0; index < length; index++) {
|
|
43
|
-
var value =
|
|
48
|
+
var value = result[index];
|
|
44
49
|
// biome-ignore lint/suspicious/noSelfCompare: ignore
|
|
45
50
|
if (value !== value) {
|
|
46
51
|
hasNaN = true;
|
|
@@ -59,21 +64,21 @@ var ultraNumberSort = exports.ultraNumberSort = function ultraNumberSort(array)
|
|
|
59
64
|
|
|
60
65
|
// Handle NaN values
|
|
61
66
|
if (hasNaN) {
|
|
62
|
-
return handleNaNSort(
|
|
67
|
+
return handleNaNSort(result, ascending);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
// For small integer ranges, use counting sort
|
|
66
71
|
if (allIntegers && max - min < length * 2 && max - min < 1000000) {
|
|
67
|
-
return countingSort(
|
|
72
|
+
return countingSort(result, min, max, ascending);
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
// For larger arrays, use radix sort if applicable
|
|
71
76
|
if (allIntegers && length > 100) {
|
|
72
|
-
return radixSort(
|
|
77
|
+
return radixSort(result, ascending);
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
// Fall back to optimized quicksort for floating point
|
|
76
|
-
return numericQuickSort(
|
|
81
|
+
return numericQuickSort(result, 0, length - 1, ascending);
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
/**
|
|
@@ -185,15 +190,15 @@ var countingSort = function countingSort(array, min, max, ascending) {
|
|
|
185
190
|
for (var index_ = 0; index_ < range; index_++) {
|
|
186
191
|
var cnt = count[index_];
|
|
187
192
|
var value = index_ + min;
|
|
188
|
-
for (var
|
|
193
|
+
for (var index__ = 0; index__ < cnt; index__++) {
|
|
189
194
|
array[index++] = value;
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
} else {
|
|
193
|
-
for (var
|
|
194
|
-
var _cnt = count[
|
|
195
|
-
var _value =
|
|
196
|
-
for (var
|
|
198
|
+
for (var _index_ = range - 1; _index_ >= 0; _index_--) {
|
|
199
|
+
var _cnt = count[_index_];
|
|
200
|
+
var _value = _index_ + min;
|
|
201
|
+
for (var _index__ = 0; _index__ < _cnt; _index__++) {
|
|
197
202
|
array[index++] = _value;
|
|
198
203
|
}
|
|
199
204
|
}
|
|
@@ -235,11 +240,11 @@ var radixSort = function radixSort(array, ascending) {
|
|
|
235
240
|
var index = 0;
|
|
236
241
|
if (ascending) {
|
|
237
242
|
// Negative numbers first (in reverse order)
|
|
238
|
-
for (var
|
|
239
|
-
array[index++] = -negative[
|
|
243
|
+
for (var _index_2 = negative.length - 1; _index_2 >= 0; _index_2--) {
|
|
244
|
+
array[index++] = -negative[_index_2];
|
|
240
245
|
}
|
|
241
246
|
// Zeros
|
|
242
|
-
for (var
|
|
247
|
+
for (var _index_3 = 0; _index_3 < zeroCount; _index_3++) {
|
|
243
248
|
array[index++] = 0;
|
|
244
249
|
}
|
|
245
250
|
// Positive numbers
|
|
@@ -257,11 +262,11 @@ var radixSort = function radixSort(array, ascending) {
|
|
|
257
262
|
}
|
|
258
263
|
} else {
|
|
259
264
|
// Positive numbers first (in reverse order)
|
|
260
|
-
for (var
|
|
261
|
-
array[index++] = positive[
|
|
265
|
+
for (var _index_4 = positive.length - 1; _index_4 >= 0; _index_4--) {
|
|
266
|
+
array[index++] = positive[_index_4];
|
|
262
267
|
}
|
|
263
268
|
// Zeros
|
|
264
|
-
for (var
|
|
269
|
+
for (var _index_5 = 0; _index_5 < zeroCount; _index_5++) {
|
|
265
270
|
array[index++] = 0;
|
|
266
271
|
}
|
|
267
272
|
// Negative numbers
|
|
@@ -335,8 +340,7 @@ var radixSortPositive = function radixSortPositive(array) {
|
|
|
335
340
|
* Optimized quicksort for numbers
|
|
336
341
|
*/
|
|
337
342
|
var numericQuickSort = function numericQuickSort(array, low, high, ascending) {
|
|
338
|
-
var stack = [];
|
|
339
|
-
stack.push(low, high);
|
|
343
|
+
var stack = [low, high];
|
|
340
344
|
while (stack.length > 0) {
|
|
341
345
|
var h = stack.pop();
|
|
342
346
|
var l = stack.pop();
|
|
@@ -380,12 +384,12 @@ var numericInsertionSort = function numericInsertionSort(array, low, high, ascen
|
|
|
380
384
|
} else {
|
|
381
385
|
for (var _index6 = low + 1; _index6 <= high; _index6++) {
|
|
382
386
|
var _key = array[_index6];
|
|
383
|
-
var
|
|
384
|
-
while (
|
|
385
|
-
array[
|
|
386
|
-
|
|
387
|
+
var _index_6 = _index6 - 1;
|
|
388
|
+
while (_index_6 >= low && array[_index_6] < _key) {
|
|
389
|
+
array[_index_6 + 1] = array[_index_6];
|
|
390
|
+
_index_6--;
|
|
387
391
|
}
|
|
388
|
-
array[
|
|
392
|
+
array[_index_6 + 1] = _key;
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Convert hexadecimal color code to RGBA color values
|
|
3
3
|
* @param hex Hexadecimal color code (3, 6, or 8 digits with #)
|
|
4
4
|
* @returns {Object} RGBA values (r, g, b as 0-255, a as 0-1)
|
|
5
|
-
* @example
|
|
5
|
+
* @example hexaToRgba("#00000000") // { r: 0, g: 0, b: 0, a: 0 }
|
|
6
6
|
* @throws {Error} If the hex code format is invalid
|
|
7
7
|
*/
|
|
8
8
|
export declare const hexaToRgba: (hex: string) => {
|
|
@@ -10,7 +10,7 @@ var _roundOf = require("@/Math/roundOf");
|
|
|
10
10
|
* Convert hexadecimal color code to RGBA color values
|
|
11
11
|
* @param hex Hexadecimal color code (3, 6, or 8 digits with #)
|
|
12
12
|
* @returns {Object} RGBA values (r, g, b as 0-255, a as 0-1)
|
|
13
|
-
* @example
|
|
13
|
+
* @example hexaToRgba("#00000000") // { r: 0, g: 0, b: 0, a: 0 }
|
|
14
14
|
* @throws {Error} If the hex code format is invalid
|
|
15
15
|
*/
|
|
16
16
|
var hexaToRgba = exports.hexaToRgba = function hexaToRgba(hex) {
|
|
@@ -19,7 +19,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
19
19
|
*/
|
|
20
20
|
var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
|
|
21
21
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
22
|
-
var bigNumber =
|
|
22
|
+
var bigNumber = 0n;
|
|
23
23
|
var _iterator = _createForOfIteratorHelper(input),
|
|
24
24
|
_step;
|
|
25
25
|
try {
|
|
@@ -29,7 +29,7 @@ var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
|
|
|
29
29
|
if (value === -1) {
|
|
30
30
|
throw new Error("Invalid base58 character: ".concat(_char));
|
|
31
31
|
}
|
|
32
|
-
bigNumber = bigNumber *
|
|
32
|
+
bigNumber = bigNumber * 58n + BigInt(value);
|
|
33
33
|
}
|
|
34
34
|
} catch (err) {
|
|
35
35
|
_iterator.e(err);
|
|
@@ -38,8 +38,8 @@ var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
|
|
|
38
38
|
}
|
|
39
39
|
var bytes = [];
|
|
40
40
|
while (bigNumber > 0) {
|
|
41
|
-
bytes.unshift(Number(bigNumber %
|
|
42
|
-
bigNumber /=
|
|
41
|
+
bytes.unshift(Number(bigNumber % 256n));
|
|
42
|
+
bigNumber /= 256n;
|
|
43
43
|
}
|
|
44
44
|
var leadingOnes = 0;
|
|
45
45
|
var _iterator2 = _createForOfIteratorHelper(input),
|
|
@@ -17,13 +17,13 @@ var encodeBase58 = exports.encodeBase58 = function encodeBase58(input) {
|
|
|
17
17
|
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
18
18
|
var bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
19
19
|
var encoded = "";
|
|
20
|
-
var bigNumber =
|
|
20
|
+
var bigNumber = 0n;
|
|
21
21
|
var _iterator = _createForOfIteratorHelper(bytes),
|
|
22
22
|
_step;
|
|
23
23
|
try {
|
|
24
24
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25
25
|
var _byte = _step.value;
|
|
26
|
-
bigNumber = bigNumber *
|
|
26
|
+
bigNumber = bigNumber * 256n + BigInt(_byte);
|
|
27
27
|
}
|
|
28
28
|
} catch (err) {
|
|
29
29
|
_iterator.e(err);
|
|
@@ -31,9 +31,9 @@ var encodeBase58 = exports.encodeBase58 = function encodeBase58(input) {
|
|
|
31
31
|
_iterator.f();
|
|
32
32
|
}
|
|
33
33
|
while (bigNumber > 0) {
|
|
34
|
-
var remainder = Number(bigNumber %
|
|
34
|
+
var remainder = Number(bigNumber % 58n);
|
|
35
35
|
encoded = alphabet[remainder] + encoded;
|
|
36
|
-
bigNumber /=
|
|
36
|
+
bigNumber /= 58n;
|
|
37
37
|
}
|
|
38
38
|
var leadingZeros = 0;
|
|
39
39
|
var _iterator2 = _createForOfIteratorHelper(bytes),
|
|
@@ -64,10 +64,10 @@ export declare class PriorityQueue<T> {
|
|
|
64
64
|
* ]);
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
|
-
constructor(initialElements?:
|
|
67
|
+
constructor(initialElements?: {
|
|
68
68
|
value: T;
|
|
69
69
|
priority: number;
|
|
70
|
-
}
|
|
70
|
+
}[]);
|
|
71
71
|
/**
|
|
72
72
|
* Returns the number of elements in the queue.
|
|
73
73
|
* @returns The number of elements in the queue
|
|
@@ -205,10 +205,10 @@ export declare class PriorityQueue<T> {
|
|
|
205
205
|
* // [{ value: "high", priority: 10 }, { value: "low", priority: 1 }] (order may vary)
|
|
206
206
|
* ```
|
|
207
207
|
*/
|
|
208
|
-
toArrayWithPriorities():
|
|
208
|
+
toArrayWithPriorities(): {
|
|
209
209
|
value: T;
|
|
210
210
|
priority: number;
|
|
211
|
-
}
|
|
211
|
+
}[];
|
|
212
212
|
/**
|
|
213
213
|
* Updates the minimum priority when adding elements.
|
|
214
214
|
* @param priority - The priority being added
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PriorityQueue = void 0;
|
|
7
|
+
var _unwrap = require("@/Tool/unwrap");
|
|
7
8
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
9
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -204,8 +205,8 @@ var PriorityQueue = exports.PriorityQueue = /*#__PURE__*/function () {
|
|
|
204
205
|
return (_this$heap$pop = this.heap.pop()) === null || _this$heap$pop === void 0 ? void 0 : _this$heap$pop.value;
|
|
205
206
|
}
|
|
206
207
|
var result = this.heap[0].value;
|
|
207
|
-
//
|
|
208
|
-
this.heap[0] = this.heap.pop();
|
|
208
|
+
// pop() cannot return undefined when heap.length > 1
|
|
209
|
+
this.heap[0] = (0, _unwrap.unwrap)(this.heap.pop(), "panic: heap is empty");
|
|
209
210
|
this.heapifyDown(0);
|
|
210
211
|
return result;
|
|
211
212
|
}
|
|
@@ -17,7 +17,8 @@ var dayOfWeek = exports.dayOfWeek = function dayOfWeek(properties) {
|
|
|
17
17
|
var timeDifference = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 9;
|
|
18
18
|
var nowTime = (0, _now.now)(timeDifference);
|
|
19
19
|
if (properties) {
|
|
20
|
-
|
|
20
|
+
var _properties$year, _properties$mon, _properties$day;
|
|
21
|
+
return (0, _new.newDateInt)((_properties$year = properties.year) !== null && _properties$year !== void 0 ? _properties$year : nowTime.getFullYear(), (_properties$mon = properties.mon) !== null && _properties$mon !== void 0 ? _properties$mon : nowTime.getMonth() + 1, (_properties$day = properties.day) !== null && _properties$day !== void 0 ? _properties$day : nowTime.getDate()).getDay();
|
|
21
22
|
}
|
|
22
23
|
return nowTime.getDay();
|
|
23
24
|
};
|
|
@@ -77,6 +77,6 @@ var format = exports.format = function format(date) {
|
|
|
77
77
|
ZZ: timezoneOffsetString.replace(":", "")
|
|
78
78
|
};
|
|
79
79
|
return formatString.replaceAll(/\[([^\]]+)]|(Y{1,4}|M{1,2}|D{1,2}|d{1,2}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS)/g, function (_match, $1, $2) {
|
|
80
|
-
return $1
|
|
80
|
+
return $1 !== null && $1 !== void 0 ? $1 : matches[$2];
|
|
81
81
|
});
|
|
82
82
|
};
|
|
@@ -34,7 +34,7 @@ var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip)
|
|
|
34
34
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
35
35
|
var octet = _step.value;
|
|
36
36
|
// Check for empty octet or leading zeros
|
|
37
|
-
if (!octet || octet.length > 1 && octet
|
|
37
|
+
if (!octet || octet.length > 1 && octet.startsWith("0")) {
|
|
38
38
|
throw new Error("Invalid IP address format");
|
|
39
39
|
}
|
|
40
40
|
var number = Number.parseInt(octet, 10);
|
|
@@ -33,7 +33,7 @@ var subnetMaskToCidr = exports.subnetMaskToCidr = function subnetMaskToCidr(subn
|
|
|
33
33
|
|
|
34
34
|
// Join octets and count consecutive 1s
|
|
35
35
|
var binaryString = binaryOctets.join("");
|
|
36
|
-
var match =
|
|
36
|
+
var match = /^1*0*$/.exec(binaryString);
|
|
37
37
|
if (!match) {
|
|
38
38
|
throw new Error("Invalid subnet mask: must be consecutive 1s followed by 0s");
|
|
39
39
|
}
|
|
@@ -78,12 +78,22 @@ var calculatorCore = exports.calculatorCore = function calculatorCore(expression
|
|
|
78
78
|
var sanitizeSigns = function sanitizeSigns(expr) {
|
|
79
79
|
return expr.replaceAll("--", "+").replaceAll("++", "+").replaceAll("+-", "+0-").replaceAll("-+", "+0-");
|
|
80
80
|
};
|
|
81
|
+
var currencyRegexCache = new Map();
|
|
82
|
+
var getCurrencyRegex = function getCurrencyRegex(currencySymbol) {
|
|
83
|
+
var cached = currencyRegexCache.get(currencySymbol);
|
|
84
|
+
if (cached) {
|
|
85
|
+
return cached;
|
|
86
|
+
}
|
|
87
|
+
var regex = new RegExp("\\".concat(currencySymbol, "([0-9]+)"));
|
|
88
|
+
currencyRegexCache.set(currencySymbol, regex);
|
|
89
|
+
return regex;
|
|
90
|
+
};
|
|
81
91
|
var applyCurrencyExchange = function applyCurrencyExchange(expr, rates) {
|
|
82
92
|
var returnExpr = expr;
|
|
83
93
|
// Currency exchange logic
|
|
84
94
|
for (var index in rates) {
|
|
85
95
|
if (returnExpr.includes(index)) {
|
|
86
|
-
var $ =
|
|
96
|
+
var $ = getCurrencyRegex(index).exec(returnExpr);
|
|
87
97
|
if ($) {
|
|
88
98
|
returnExpr = returnExpr.replace($[0], (0, _convertCurrency.convertCurrency)($[0], rates));
|
|
89
99
|
}
|
|
@@ -96,7 +106,7 @@ var containsParentheses = function containsParentheses(expr) {
|
|
|
96
106
|
};
|
|
97
107
|
var resolveParentheses = function resolveParentheses(expr) {
|
|
98
108
|
// Logic for calculations inside parentheses
|
|
99
|
-
var match =
|
|
109
|
+
var match = /\((-?\d+(?:\.\d+)?)([*+/-])(-?\d+(?:\.\d+)?)\)/.exec(expr);
|
|
100
110
|
if (match) {
|
|
101
111
|
return expr.replace(match[0], calculatorCore(match[0].replaceAll(/\(|\)/g, "")));
|
|
102
112
|
}
|
|
@@ -110,7 +120,7 @@ var containsDiv = function containsDiv(expr) {
|
|
|
110
120
|
};
|
|
111
121
|
var resolveMulExp = function resolveMulExp(expr) {
|
|
112
122
|
// Logic for multiplication and exponentiation
|
|
113
|
-
var match =
|
|
123
|
+
var match = /(.*?)(-?\d+(?:\.\d+)?)([*^])(-?\d+(?:\.\d+)?)$/.exec(expr);
|
|
114
124
|
if (match) {
|
|
115
125
|
var result = match[3] === "^" ? Math.pow(Number(match[2]), Number(match[4])) : (0, _multiplication.multiplication)(Number(match[2]), Number(match[4]));
|
|
116
126
|
return "".concat(match[1]).concat(result);
|
|
@@ -119,7 +129,7 @@ var resolveMulExp = function resolveMulExp(expr) {
|
|
|
119
129
|
};
|
|
120
130
|
var resolveDiv = function resolveDiv(expr) {
|
|
121
131
|
// Logic for division
|
|
122
|
-
var match =
|
|
132
|
+
var match = /(-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)/.exec(expr);
|
|
123
133
|
if (match) {
|
|
124
134
|
var result = (0, _division.division)(Number(match[1]), Number(match[2]));
|
|
125
135
|
return expr.replace(match[0], String(result));
|
|
@@ -131,7 +141,7 @@ var containsAddSub = function containsAddSub(expr) {
|
|
|
131
141
|
};
|
|
132
142
|
var resolveAddSub = function resolveAddSub(expr) {
|
|
133
143
|
// Logic for addition and subtraction
|
|
134
|
-
var match =
|
|
144
|
+
var match = /(-?\d+(?:\.\d+)?)(\+|-)(-?\d+(?:\.\d+)?)/.exec(expr);
|
|
135
145
|
if (match) {
|
|
136
146
|
var result = match[2] === "+" ? (0, _addition.addition)(Number(match[1]), Number(match[3])) : (0, _subtract.subtract)(Number(match[1]), Number(match[3]));
|
|
137
147
|
return expr.replace(match[0], String(result));
|
package/module/es5/Math/gcd.js
CHANGED
|
@@ -62,8 +62,11 @@ var _gcdInteger = function gcdInteger(x, y) {
|
|
|
62
62
|
var copyZ = z.map(function (element) {
|
|
63
63
|
return Math.abs(Math.round(element));
|
|
64
64
|
});
|
|
65
|
-
if (copyX === 0
|
|
66
|
-
return
|
|
65
|
+
if (copyX === 0) {
|
|
66
|
+
return copyY;
|
|
67
|
+
}
|
|
68
|
+
if (copyY === 0) {
|
|
69
|
+
return copyX;
|
|
67
70
|
}
|
|
68
71
|
/* Euclidean algorithm */
|
|
69
72
|
var _ref = [Math.max(copyX, copyY), Math.min(copyX, copyY)];
|
|
@@ -24,7 +24,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
24
24
|
var _mathConverter = exports.mathConverter = function mathConverter(equation) {
|
|
25
25
|
var convertedEquation = equation;
|
|
26
26
|
while (true) {
|
|
27
|
-
var multiplicationOrExponentiation =
|
|
27
|
+
var multiplicationOrExponentiation = /\d+\.?(\d+)?(\*|\^)\d+\.?(\d+)?/.exec(convertedEquation);
|
|
28
28
|
if (!multiplicationOrExponentiation) {
|
|
29
29
|
return convertedEquation;
|
|
30
30
|
}
|
package/module/es5/Math/mode.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mode = void 0;
|
|
7
|
+
var _ultraNumberSort = require("@/Array/ultraNumberSort");
|
|
7
8
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
10
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -32,8 +33,9 @@ var mode = exports.mode = function mode(array) {
|
|
|
32
33
|
_step;
|
|
33
34
|
try {
|
|
34
35
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36
|
+
var _frequency$get;
|
|
35
37
|
var value = _step.value;
|
|
36
|
-
var count = (frequency.get(value)
|
|
38
|
+
var count = ((_frequency$get = frequency.get(value)) !== null && _frequency$get !== void 0 ? _frequency$get : 0) + 1;
|
|
37
39
|
frequency.set(value, count);
|
|
38
40
|
maxFrequency = Math.max(maxFrequency, count);
|
|
39
41
|
}
|
|
@@ -61,7 +63,5 @@ var mode = exports.mode = function mode(array) {
|
|
|
61
63
|
} finally {
|
|
62
64
|
_iterator2.f();
|
|
63
65
|
}
|
|
64
|
-
return
|
|
65
|
-
return a - b;
|
|
66
|
-
});
|
|
66
|
+
return (0, _ultraNumberSort.ultraNumberSort)(modes);
|
|
67
67
|
};
|
package/module/es5/Math/nCr.js
CHANGED
|
@@ -16,9 +16,12 @@ var _nPr = require("./nPr");
|
|
|
16
16
|
* where the order doesn't matter. Uses the formula nCr = nPr / r!
|
|
17
17
|
*/
|
|
18
18
|
var nCr = exports.nCr = function nCr(n, r) {
|
|
19
|
-
if (n
|
|
19
|
+
if (n < r || n < 0 || r < 0) {
|
|
20
20
|
return Number.NaN;
|
|
21
21
|
}
|
|
22
|
+
if (r === 0 || n === r) {
|
|
23
|
+
return 1;
|
|
24
|
+
}
|
|
22
25
|
var numerator = (0, _nPr.nPr)(n, r);
|
|
23
26
|
var denominator = 1;
|
|
24
27
|
for (var index = 2; index <= r; index++) {
|