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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retry = void 0;
|
|
7
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
8
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
9
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
|
+
/**
|
|
12
|
+
* Retries a given async function with configurable retry logic
|
|
13
|
+
*
|
|
14
|
+
* @template T - The return type of the function
|
|
15
|
+
* @param function_ - The async function to retry
|
|
16
|
+
* @param options - Configuration options for retry behavior
|
|
17
|
+
* @param options.retries - Maximum number of retry attempts (default: 3)
|
|
18
|
+
* @param options.delay - Delay between retries in milliseconds (default: 1000)
|
|
19
|
+
* @param options.shouldRetry - Function to determine if an error should trigger a retry (default: always retry)
|
|
20
|
+
* @returns Promise that resolves with the function result or rejects with the final error
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Basic usage with default options
|
|
25
|
+
* const result = await retry(async () => {
|
|
26
|
+
* const response = await fetch('/api/data');
|
|
27
|
+
* if (!response.ok) throw new Error('Failed to fetch');
|
|
28
|
+
* return response.json();
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Custom retry configuration
|
|
32
|
+
* const result = await retry(
|
|
33
|
+
* () => riskyOperation(),
|
|
34
|
+
* {
|
|
35
|
+
* retries: 5,
|
|
36
|
+
* delay: 2000,
|
|
37
|
+
* shouldRetry: (error) => error instanceof NetworkError
|
|
38
|
+
* }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
var retry = exports.retry = function retry(function_) {
|
|
43
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
+
var _options$retries = options.retries,
|
|
45
|
+
retries = _options$retries === void 0 ? 3 : _options$retries,
|
|
46
|
+
_options$delay = options.delay,
|
|
47
|
+
delay = _options$delay === void 0 ? 1000 : _options$delay,
|
|
48
|
+
_options$shouldRetry = options.shouldRetry,
|
|
49
|
+
shouldRetry = _options$shouldRetry === void 0 ? function () {
|
|
50
|
+
return true;
|
|
51
|
+
} : _options$shouldRetry;
|
|
52
|
+
var _attempt = /*#__PURE__*/function () {
|
|
53
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(remainingAttempts) {
|
|
54
|
+
var _t;
|
|
55
|
+
return _regenerator().w(function (_context) {
|
|
56
|
+
while (1) switch (_context.n) {
|
|
57
|
+
case 0:
|
|
58
|
+
_context.p = 0;
|
|
59
|
+
_context.n = 1;
|
|
60
|
+
return function_();
|
|
61
|
+
case 1:
|
|
62
|
+
return _context.a(2, _context.v);
|
|
63
|
+
case 2:
|
|
64
|
+
_context.p = 2;
|
|
65
|
+
_t = _context.v;
|
|
66
|
+
if (!(remainingAttempts <= 0 || !shouldRetry(_t))) {
|
|
67
|
+
_context.n = 3;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
throw _t;
|
|
71
|
+
case 3:
|
|
72
|
+
_context.n = 4;
|
|
73
|
+
return new Promise(function (resolve) {
|
|
74
|
+
return setTimeout(function () {
|
|
75
|
+
return resolve(_attempt(remainingAttempts - 1));
|
|
76
|
+
}, delay);
|
|
77
|
+
});
|
|
78
|
+
case 4:
|
|
79
|
+
return _context.a(2, _context.v);
|
|
80
|
+
}
|
|
81
|
+
}, _callee, null, [[0, 2]]);
|
|
82
|
+
}));
|
|
83
|
+
return function attempt(_x) {
|
|
84
|
+
return _ref.apply(this, arguments);
|
|
85
|
+
};
|
|
86
|
+
}();
|
|
87
|
+
return _attempt(retries);
|
|
88
|
+
};
|
|
@@ -19,7 +19,7 @@ var getIpClass = exports.getIpClass = function getIpClass(ip) {
|
|
|
19
19
|
if (parts.length !== 4) {
|
|
20
20
|
return "";
|
|
21
21
|
}
|
|
22
|
-
var firstOctet = Number.parseInt(parts[0]);
|
|
22
|
+
var firstOctet = Number.parseInt(parts[0], 10);
|
|
23
23
|
if (Number.isNaN(firstOctet) || firstOctet < 0 || firstOctet > 255) {
|
|
24
24
|
return "";
|
|
25
25
|
}
|
|
@@ -25,7 +25,7 @@ var getNetworkAddress = exports.getNetworkAddress = function getNetworkAddress(i
|
|
|
25
25
|
// Validate IP format
|
|
26
26
|
var ipParts = ip.split(".");
|
|
27
27
|
if (ipParts.length !== 4 || !ipParts.every(function (part) {
|
|
28
|
-
var number_ = Number.parseInt(part);
|
|
28
|
+
var number_ = Number.parseInt(part, 10);
|
|
29
29
|
return !Number.isNaN(number_) && number_ >= 0 && number_ <= 255;
|
|
30
30
|
})) {
|
|
31
31
|
throw new TypeError("Invalid IP address or subnet mask");
|
|
@@ -34,7 +34,7 @@ var getNetworkAddress = exports.getNetworkAddress = function getNetworkAddress(i
|
|
|
34
34
|
// Validate subnet mask format
|
|
35
35
|
var maskParts = subnetMask.split(".");
|
|
36
36
|
if (maskParts.length !== 4 || !maskParts.every(function (part) {
|
|
37
|
-
var number_ = Number.parseInt(part);
|
|
37
|
+
var number_ = Number.parseInt(part, 10);
|
|
38
38
|
return !Number.isNaN(number_) && number_ >= 0 && number_ <= 255;
|
|
39
39
|
})) {
|
|
40
40
|
throw new TypeError("Invalid IP address or subnet mask");
|
|
@@ -37,7 +37,7 @@ var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip)
|
|
|
37
37
|
if (!octet || octet.length > 1 && octet[0] === "0") {
|
|
38
38
|
throw new Error("Invalid IP address format");
|
|
39
39
|
}
|
|
40
|
-
var number = Number.parseInt(octet);
|
|
40
|
+
var number = Number.parseInt(octet, 10);
|
|
41
41
|
if (Number.isNaN(number) || number < 0 || number > 255) {
|
|
42
42
|
throw new Error("Invalid IP address format");
|
|
43
43
|
}
|
|
@@ -50,6 +50,6 @@ var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip)
|
|
|
50
50
|
_iterator.f();
|
|
51
51
|
}
|
|
52
52
|
return parts.map(function (octet) {
|
|
53
|
-
return Number.parseInt(octet).toString(2).padStart(8, "0");
|
|
53
|
+
return Number.parseInt(octet, 10).toString(2).padStart(8, "0");
|
|
54
54
|
}).join("");
|
|
55
55
|
};
|
|
@@ -24,7 +24,7 @@ var subnetMaskToCidr = exports.subnetMaskToCidr = function subnetMaskToCidr(subn
|
|
|
24
24
|
|
|
25
25
|
// Validate each octet
|
|
26
26
|
var binaryOctets = octets.map(function (octet) {
|
|
27
|
-
var number_ = Number.parseInt(octet);
|
|
27
|
+
var number_ = Number.parseInt(octet, 10);
|
|
28
28
|
if (Number.isNaN(number_) || number_ < 0 || number_ > 255) {
|
|
29
29
|
throw new Error("Invalid subnet mask format");
|
|
30
30
|
}
|
|
@@ -11,6 +11,10 @@ var _multiplication = require("@/Math/multiplication");
|
|
|
11
11
|
var _subtract = require("@/Math/subtract");
|
|
12
12
|
var _isNumber = require("@/Validate/isNumber");
|
|
13
13
|
var calculatorCore = exports.calculatorCore = function calculatorCore(expression, currencyExchange) {
|
|
14
|
+
// Handle empty string
|
|
15
|
+
if (expression === "") {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
14
18
|
var sanitizedExpression = expression;
|
|
15
19
|
|
|
16
20
|
// Handle signs
|
|
@@ -61,6 +65,12 @@ var calculatorCore = exports.calculatorCore = function calculatorCore(expression
|
|
|
61
65
|
|
|
62
66
|
// Return result if no more calculations needed
|
|
63
67
|
else {
|
|
68
|
+
var number_ = Number(sanitizedExpression);
|
|
69
|
+
if (!Number.isNaN(number_)) {
|
|
70
|
+
// Handle floating point precision issues
|
|
71
|
+
var rounded = Math.round(number_ * 1e10) / 1e10;
|
|
72
|
+
return rounded.toString();
|
|
73
|
+
}
|
|
64
74
|
return sanitizedExpression;
|
|
65
75
|
}
|
|
66
76
|
}
|
|
@@ -86,7 +96,7 @@ var containsParentheses = function containsParentheses(expr) {
|
|
|
86
96
|
};
|
|
87
97
|
var resolveParentheses = function resolveParentheses(expr) {
|
|
88
98
|
// Logic for calculations inside parentheses
|
|
89
|
-
var match = expr.match(/\(
|
|
99
|
+
var match = expr.match(/\((-?\d+(?:\.\d+)?)([*+/-])(-?\d+(?:\.\d+)?)\)/);
|
|
90
100
|
if (match) {
|
|
91
101
|
return expr.replace(match[0], calculatorCore(match[0].replaceAll(/\(|\)/g, "")));
|
|
92
102
|
}
|
|
@@ -100,20 +110,18 @@ var containsDiv = function containsDiv(expr) {
|
|
|
100
110
|
};
|
|
101
111
|
var resolveMulExp = function resolveMulExp(expr) {
|
|
102
112
|
// Logic for multiplication and exponentiation
|
|
103
|
-
var match = expr.match(/(.*?)(
|
|
113
|
+
var match = expr.match(/(.*?)(-?\d+(?:\.\d+)?)([*^])(-?\d+(?:\.\d+)?)$/);
|
|
104
114
|
if (match) {
|
|
105
|
-
var
|
|
106
|
-
var result = operands[1] === "^" ? Math.pow(Number(operands[0]), Number(operands[2])) : (0, _multiplication.multiplication)(Number(operands[0]), Number(operands[2]));
|
|
115
|
+
var result = match[3] === "^" ? Math.pow(Number(match[2]), Number(match[4])) : (0, _multiplication.multiplication)(Number(match[2]), Number(match[4]));
|
|
107
116
|
return "".concat(match[1]).concat(result);
|
|
108
117
|
}
|
|
109
118
|
return Number.NaN.toString();
|
|
110
119
|
};
|
|
111
120
|
var resolveDiv = function resolveDiv(expr) {
|
|
112
121
|
// Logic for division
|
|
113
|
-
var match = expr.match(
|
|
122
|
+
var match = expr.match(/(-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)/);
|
|
114
123
|
if (match) {
|
|
115
|
-
var
|
|
116
|
-
var result = (0, _division.division)(Number(operands[0]), Number(operands[2]));
|
|
124
|
+
var result = (0, _division.division)(Number(match[1]), Number(match[2]));
|
|
117
125
|
return expr.replace(match[0], String(result));
|
|
118
126
|
}
|
|
119
127
|
return Number.NaN.toString();
|
|
@@ -123,9 +131,9 @@ var containsAddSub = function containsAddSub(expr) {
|
|
|
123
131
|
};
|
|
124
132
|
var resolveAddSub = function resolveAddSub(expr) {
|
|
125
133
|
// Logic for addition and subtraction
|
|
126
|
-
var match = expr.match(/(-?\d+
|
|
134
|
+
var match = expr.match(/(-?\d+(?:\.\d+)?)(\+|-)(-?\d+(?:\.\d+)?)/);
|
|
127
135
|
if (match) {
|
|
128
|
-
var result = match[
|
|
136
|
+
var result = match[2] === "+" ? (0, _addition.addition)(Number(match[1]), Number(match[3])) : (0, _subtract.subtract)(Number(match[1]), Number(match[3]));
|
|
129
137
|
return expr.replace(match[0], String(result));
|
|
130
138
|
}
|
|
131
139
|
return Number.NaN.toString();
|
|
@@ -19,18 +19,24 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
19
19
|
* @example literalExpression("3x+2=8"); // "2"
|
|
20
20
|
*/
|
|
21
21
|
var literalExpression = exports.literalExpression = function literalExpression(x) {
|
|
22
|
+
// Handle invalid equations like x=x
|
|
23
|
+
var sides = x.split("=");
|
|
24
|
+
if (sides.length === 2 && sides[0] === sides[1]) {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
// Store numerical and variable parts of the equation
|
|
23
29
|
var numericalPart = "";
|
|
24
30
|
var variablePart = [];
|
|
25
31
|
|
|
26
32
|
// Split by equals sign and identify numerical and variable parts
|
|
27
|
-
var _iterator = _createForOfIteratorHelper(
|
|
33
|
+
var _iterator = _createForOfIteratorHelper(sides),
|
|
28
34
|
_step;
|
|
29
35
|
try {
|
|
30
36
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
31
37
|
var part = _step.value;
|
|
32
38
|
if (/[A-Za-z]+/.test(part)) {
|
|
33
|
-
variablePart = part.split(/(
|
|
39
|
+
variablePart = part.split(/([-+]?\d*[A-Za-z]+)|([-+]?\d+)/).filter(function (n) {
|
|
34
40
|
return n && n !== undefined;
|
|
35
41
|
});
|
|
36
42
|
} else {
|
|
@@ -45,11 +51,19 @@ var literalExpression = exports.literalExpression = function literalExpression(x
|
|
|
45
51
|
_iterator.f();
|
|
46
52
|
}
|
|
47
53
|
if (variablePart[1]) {
|
|
48
|
-
|
|
54
|
+
// Invert signs before calculating
|
|
55
|
+
var invertedPart = variablePart[1].replaceAll("+", "plus").replaceAll("-", "minus").replaceAll("plus", "-").replaceAll("minus", "+");
|
|
56
|
+
variablePart[1] = (0, _core.calculatorCore)(invertedPart);
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
// Calculate the numerical part
|
|
52
|
-
|
|
60
|
+
if (variablePart[1]) {
|
|
61
|
+
// Ensure proper sign handling when combining
|
|
62
|
+
var sign = variablePart[1].startsWith("-") ? "" : "+";
|
|
63
|
+
numericalPart = (0, _core.calculatorCore)("".concat(numericalPart).concat(sign).concat(variablePart[1]));
|
|
64
|
+
} else {
|
|
65
|
+
numericalPart = (0, _core.calculatorCore)(numericalPart);
|
|
66
|
+
}
|
|
53
67
|
|
|
54
68
|
// Split the variable part again to separate coefficient and variable
|
|
55
69
|
variablePart = variablePart[0].split(/(\d+)|([A-Za-z]+)/).filter(function (n) {
|
|
@@ -68,8 +82,7 @@ var literalExpression = exports.literalExpression = function literalExpression(x
|
|
|
68
82
|
if (/(-?)\d+\/1/.test(numericalPart)) {
|
|
69
83
|
return numericalPart.replace(/\/1/, "");
|
|
70
84
|
}
|
|
71
|
-
}
|
|
72
|
-
if (variablePart[0] !== "1") {
|
|
85
|
+
} else if (variablePart[0] !== "1") {
|
|
73
86
|
numericalPart = "".concat(numericalPart, "/").concat(variablePart[0]);
|
|
74
87
|
}
|
|
75
88
|
return numericalPart;
|
|
@@ -17,7 +17,7 @@ var _getDecimalLength = require("./getDecimalLength");
|
|
|
17
17
|
var division = exports.division = function division(x, y) {
|
|
18
18
|
var isFloor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
19
19
|
if (y === 0) {
|
|
20
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
20
|
+
// biome-ignore lint/suspicious/noExplicitAny: ignore
|
|
21
21
|
return isFloor ? Number.NaN : [Number.NaN, Number.NaN];
|
|
22
22
|
}
|
|
23
23
|
var sign = Math.sign(x) * Math.sign(y);
|
|
@@ -39,12 +39,12 @@ var division = exports.division = function division(x, y) {
|
|
|
39
39
|
var divisionResult = xInt / yInt * scalingFactor;
|
|
40
40
|
if (isFloor) {
|
|
41
41
|
// Apply sign to result
|
|
42
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
42
|
+
// biome-ignore lint/suspicious/noExplicitAny: ignore
|
|
43
43
|
return sign * divisionResult;
|
|
44
44
|
}
|
|
45
45
|
// When isFloor is false, calculate quotient and remainder
|
|
46
46
|
var intQuotient = Math.floor(divisionResult);
|
|
47
47
|
var remainder = xInt % yInt;
|
|
48
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
48
|
+
// biome-ignore lint/suspicious/noExplicitAny: ignore
|
|
49
49
|
return [sign * intQuotient, remainder];
|
|
50
50
|
};
|
package/module/es5/Math/gcd.js
CHANGED
|
@@ -4,8 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.gcd = void 0;
|
|
7
|
+
var _isDouble = require("@/Validate/isDouble");
|
|
7
8
|
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; } } }; }
|
|
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."); }
|
|
8
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); }
|
|
9
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; }
|
|
10
15
|
/**
|
|
11
16
|
* Greatest Common Divisor (GCD)
|
|
@@ -15,14 +20,47 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
15
20
|
* @returns number The GCD of all input numbers
|
|
16
21
|
* @example gcd(12, 18); // 6
|
|
17
22
|
*/
|
|
18
|
-
var
|
|
19
|
-
var copyX = Math.abs(x);
|
|
20
|
-
var copyY = Math.abs(y);
|
|
23
|
+
var gcd = exports.gcd = function gcd(x, y) {
|
|
21
24
|
for (var _len = arguments.length, z = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
22
25
|
z[_key - 2] = arguments[_key];
|
|
23
26
|
}
|
|
27
|
+
// Handle decimal numbers by scaling them to integers
|
|
28
|
+
var allNumbers = [x, y].concat(z);
|
|
29
|
+
|
|
30
|
+
// If any number is decimal, find common decimal places and scale
|
|
31
|
+
var hasDecimals = allNumbers.some(function (number_) {
|
|
32
|
+
return (0, _isDouble.isDouble)(number_, false);
|
|
33
|
+
});
|
|
34
|
+
if (hasDecimals) {
|
|
35
|
+
// Find maximum decimal places
|
|
36
|
+
var getDecimalPlaces = function getDecimalPlaces(number_) {
|
|
37
|
+
var string_ = number_.toString();
|
|
38
|
+
return string_.includes(".") ? string_.split(".")[1].length : 0;
|
|
39
|
+
};
|
|
40
|
+
var maxDecimalPlaces = Math.max.apply(Math, _toConsumableArray(allNumbers.map(function (number_) {
|
|
41
|
+
return getDecimalPlaces(number_);
|
|
42
|
+
})));
|
|
43
|
+
var multiplier = Math.pow(10, maxDecimalPlaces);
|
|
44
|
+
|
|
45
|
+
// Scale all numbers to integers
|
|
46
|
+
var scaledNumbers = allNumbers.map(function (number_) {
|
|
47
|
+
return Math.round(number_ * multiplier);
|
|
48
|
+
});
|
|
49
|
+
var result = _gcdInteger.apply(void 0, [scaledNumbers[0], scaledNumbers[1]].concat(_toConsumableArray(scaledNumbers.slice(2))));
|
|
50
|
+
|
|
51
|
+
// Scale back to original decimal range
|
|
52
|
+
return result / multiplier;
|
|
53
|
+
}
|
|
54
|
+
return _gcdInteger.apply(void 0, [x, y].concat(z));
|
|
55
|
+
};
|
|
56
|
+
var _gcdInteger = function gcdInteger(x, y) {
|
|
57
|
+
var copyX = Math.abs(Math.round(x));
|
|
58
|
+
var copyY = Math.abs(Math.round(y));
|
|
59
|
+
for (var _len2 = arguments.length, z = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
60
|
+
z[_key2 - 2] = arguments[_key2];
|
|
61
|
+
}
|
|
24
62
|
var copyZ = z.map(function (element) {
|
|
25
|
-
return Math.abs(element);
|
|
63
|
+
return Math.abs(Math.round(element));
|
|
26
64
|
});
|
|
27
65
|
if (copyX === 0 || copyY === 0) {
|
|
28
66
|
return 0;
|
|
@@ -43,7 +81,7 @@ var _gcd = exports.gcd = function gcd(x, y) {
|
|
|
43
81
|
try {
|
|
44
82
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
45
83
|
var element = _step.value;
|
|
46
|
-
copyX =
|
|
84
|
+
copyX = _gcdInteger(copyX, element);
|
|
47
85
|
}
|
|
48
86
|
} catch (err) {
|
|
49
87
|
_iterator.e(err);
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.standardDeviation = void 0;
|
|
7
7
|
var _average = require("./average");
|
|
8
|
+
var _multiplication = require("@/Math/multiplication");
|
|
9
|
+
var _subtract = require("@/Math/subtract");
|
|
8
10
|
/**
|
|
9
11
|
* Calculates the standard deviation of a set of values
|
|
10
12
|
* @param {number[]} values Array of numeric values
|
|
@@ -21,8 +23,8 @@ var standardDeviation = exports.standardDeviation = function standardDeviation(v
|
|
|
21
23
|
|
|
22
24
|
// Calculate the squared differences from the mean
|
|
23
25
|
var squareDiffs = values.map(function (value) {
|
|
24
|
-
var diff = value
|
|
25
|
-
return diff
|
|
26
|
+
var diff = (0, _subtract.subtract)(value, avg);
|
|
27
|
+
return (0, _multiplication.multiplication)(diff, diff);
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
// Calculate the mean of the squared differences
|
package/module/es5/Object/has.js
CHANGED
|
@@ -30,7 +30,7 @@ var has = exports.has = function has(object, path) {
|
|
|
30
30
|
try {
|
|
31
31
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
32
32
|
var _key = _step.value;
|
|
33
|
-
if (current == null || !Object.
|
|
33
|
+
if (current == null || !Object.hasOwn(current, _key)) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
current = current[_key];
|
|
@@ -14,6 +14,17 @@ Object.keys(_has).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _isEmpty = require("./isEmpty");
|
|
18
|
+
Object.keys(_isEmpty).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _isEmpty[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _isEmpty[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
var _keyBy = require("./keyBy");
|
|
18
29
|
Object.keys(_keyBy).forEach(function (key) {
|
|
19
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -25,6 +36,39 @@ Object.keys(_keyBy).forEach(function (key) {
|
|
|
25
36
|
}
|
|
26
37
|
});
|
|
27
38
|
});
|
|
39
|
+
var _merge = require("./merge");
|
|
40
|
+
Object.keys(_merge).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _merge[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _merge[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _mergeDeep = require("./mergeDeep");
|
|
51
|
+
Object.keys(_mergeDeep).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _mergeDeep[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _mergeDeep[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _omit = require("./omit");
|
|
62
|
+
Object.keys(_omit).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _omit[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _omit[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
28
72
|
var _pick = require("./pick");
|
|
29
73
|
Object.keys(_pick).forEach(function (key) {
|
|
30
74
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isEmpty = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if an object is empty (has no own properties)
|
|
9
|
+
* @param object - The object to check
|
|
10
|
+
* @returns true if the object is empty, false otherwise
|
|
11
|
+
*/
|
|
12
|
+
var isEmpty = exports.isEmpty = function isEmpty(object) {
|
|
13
|
+
// Check enumerable string keys
|
|
14
|
+
for (var key in object) {
|
|
15
|
+
if (Object.hasOwn(object, key)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Check symbol properties
|
|
21
|
+
var symbolKeys = Object.getOwnPropertySymbols(object);
|
|
22
|
+
if (symbolKeys.length > 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UnionToIntersection } from "$/logic/unionToIntersection";
|
|
2
|
+
/**
|
|
3
|
+
* Merges multiple objects into a single object (shallow merge)
|
|
4
|
+
* @param target - The target object to merge into
|
|
5
|
+
* @param sources - The source objects to merge from
|
|
6
|
+
* @returns The merged object
|
|
7
|
+
*/
|
|
8
|
+
export declare const merge: <T extends Record<string, unknown>, U extends Record<string, unknown>[]>(target: T, ...sources: U) => T & UnionToIntersection<U[number]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.merge = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Merges multiple objects into a single object (shallow merge)
|
|
9
|
+
* @param target - The target object to merge into
|
|
10
|
+
* @param sources - The source objects to merge from
|
|
11
|
+
* @returns The merged object
|
|
12
|
+
*/
|
|
13
|
+
var merge = exports.merge = function merge(target) {
|
|
14
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
15
|
+
sources[_key - 1] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
return Object.assign.apply(Object, [{}, target].concat(sources));
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UnionToIntersection } from "$/logic/unionToIntersection";
|
|
2
|
+
/**
|
|
3
|
+
* Deeply merges multiple objects into a single object
|
|
4
|
+
* @param target - The target object to merge into
|
|
5
|
+
* @param sources - The source objects to merge from
|
|
6
|
+
* @returns The deeply merged object
|
|
7
|
+
*/
|
|
8
|
+
export declare const mergeDeep: <T extends Record<string, unknown>, U extends Record<string, unknown>[]>(target: T, ...sources: U) => T & UnionToIntersection<U[number]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mergeDeep = void 0;
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
14
|
+
* Checks if a value is a plain object
|
|
15
|
+
*/
|
|
16
|
+
var isPlainObject = function isPlainObject(value) {
|
|
17
|
+
return value !== null && _typeof(value) === "object" && value.constructor === Object && Object.prototype.toString.call(value) === "[object Object]";
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Deeply merges multiple objects into a single object
|
|
22
|
+
* @param target - The target object to merge into
|
|
23
|
+
* @param sources - The source objects to merge from
|
|
24
|
+
* @returns The deeply merged object
|
|
25
|
+
*/
|
|
26
|
+
var _mergeDeep = exports.mergeDeep = function mergeDeep(target) {
|
|
27
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
28
|
+
sources[_key - 1] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
if (sources.length === 0) {
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
33
|
+
var source = sources.shift();
|
|
34
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
|
35
|
+
var result = _objectSpread({}, target);
|
|
36
|
+
for (var key in source) {
|
|
37
|
+
if (Object.hasOwn(source, key)) {
|
|
38
|
+
var sourceValue = source[key];
|
|
39
|
+
var targetValue = result[key];
|
|
40
|
+
result[key] = isPlainObject(targetValue) && isPlainObject(sourceValue) ? _mergeDeep(targetValue, sourceValue) : sourceValue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return _mergeDeep.apply(void 0, [result].concat(sources));
|
|
44
|
+
}
|
|
45
|
+
return _mergeDeep.apply(void 0, [source].concat(sources));
|
|
46
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object without the specified keys
|
|
3
|
+
* @param object - The source object
|
|
4
|
+
* @param keys - The keys to omit
|
|
5
|
+
* @returns A new object without the specified keys
|
|
6
|
+
*/
|
|
7
|
+
export declare const omit: <T extends object, K extends keyof T>(object: T, ...keys: K[]) => Omit<T, K>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.omit = void 0;
|
|
7
|
+
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
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
/**
|
|
14
|
+
* Creates an object without the specified keys
|
|
15
|
+
* @param object - The source object
|
|
16
|
+
* @param keys - The keys to omit
|
|
17
|
+
* @returns A new object without the specified keys
|
|
18
|
+
*/
|
|
19
|
+
var omit = exports.omit = function omit(object) {
|
|
20
|
+
var result = _objectSpread({}, object);
|
|
21
|
+
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
22
|
+
keys[_key - 1] = arguments[_key];
|
|
23
|
+
}
|
|
24
|
+
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
|
25
|
+
var key = _keys[_i];
|
|
26
|
+
delete result[key];
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
};
|