umt 2.13.0 → 2.15.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.
Files changed (199) hide show
  1. package/module/Array/arraysJoin.js +9 -1
  2. package/module/Array/arraysJoin.js.map +1 -1
  3. package/module/Array/sum.js +35 -2
  4. package/module/Array/sum.js.map +1 -1
  5. package/module/Array/ultraNumberSort.js +8 -3
  6. package/module/Array/ultraNumberSort.js.map +1 -1
  7. package/module/Array/zip.js +21 -5
  8. package/module/Array/zip.js.map +1 -1
  9. package/module/Array/zipLongest.js +23 -4
  10. package/module/Array/zipLongest.js.map +1 -1
  11. package/module/Crypto/decodeBase32.js +3 -2
  12. package/module/Crypto/decodeBase32.js.map +1 -1
  13. package/module/Crypto/decodeBase58.js +6 -4
  14. package/module/Crypto/decodeBase58.js.map +1 -1
  15. package/module/Crypto/encodeBase32.js +11 -6
  16. package/module/Crypto/encodeBase32.js.map +1 -1
  17. package/module/Crypto/encodeBase58.js +5 -2
  18. package/module/Crypto/encodeBase58.js.map +1 -1
  19. package/module/DataStructure/priorityQueue.js +8 -1
  20. package/module/DataStructure/priorityQueue.js.map +1 -1
  21. package/module/IP/ipToBinaryString.js +3 -1
  22. package/module/IP/ipToBinaryString.js.map +1 -1
  23. package/module/IP/longToIp.d.ts +1 -1
  24. package/module/IP/longToIp.js +2 -7
  25. package/module/IP/longToIp.js.map +1 -1
  26. package/module/Math/addition.js +4 -11
  27. package/module/Math/addition.js.map +1 -1
  28. package/module/Math/multiplication.js +14 -6
  29. package/module/Math/multiplication.js.map +1 -1
  30. package/module/Math/nCr.js +6 -2
  31. package/module/Math/nCr.js.map +1 -1
  32. package/module/Math/standardDeviation.js +12 -7
  33. package/module/Math/standardDeviation.js.map +1 -1
  34. package/module/Math/subtract.js +5 -9
  35. package/module/Math/subtract.js.map +1 -1
  36. package/module/Object/deepClone.d.ts +10 -0
  37. package/module/Object/deepClone.js +16 -6
  38. package/module/Object/deepClone.js.map +1 -1
  39. package/module/Object/getObjectsCommon.d.ts +10 -0
  40. package/module/Object/getObjectsCommon.js +10 -0
  41. package/module/Object/getObjectsCommon.js.map +1 -1
  42. package/module/Object/getObjectsDiff.d.ts +10 -0
  43. package/module/Object/getObjectsDiff.js +17 -6
  44. package/module/Object/getObjectsDiff.js.map +1 -1
  45. package/module/Object/has.d.ts +10 -0
  46. package/module/Object/has.js +10 -0
  47. package/module/Object/has.js.map +1 -1
  48. package/module/Object/index.d.ts +4 -0
  49. package/module/Object/index.js +4 -0
  50. package/module/Object/index.js.map +1 -1
  51. package/module/Object/keyBy.d.ts +10 -0
  52. package/module/Object/keyBy.js +10 -0
  53. package/module/Object/keyBy.js.map +1 -1
  54. package/module/Object/mapKeys.d.ts +10 -0
  55. package/module/Object/mapKeys.js +12 -1
  56. package/module/Object/mapKeys.js.map +1 -1
  57. package/module/Object/mapValues.d.ts +10 -0
  58. package/module/Object/mapValues.js +10 -0
  59. package/module/Object/mapValues.js.map +1 -1
  60. package/module/Object/merge.d.ts +10 -0
  61. package/module/Object/merge.js +17 -1
  62. package/module/Object/merge.js.map +1 -1
  63. package/module/Object/mergeDeep.d.ts +10 -0
  64. package/module/Object/mergeDeep.js +29 -15
  65. package/module/Object/mergeDeep.js.map +1 -1
  66. package/module/Object/pickDeep.d.ts +10 -0
  67. package/module/Object/pickDeep.js +10 -5
  68. package/module/Object/pickDeep.js.map +1 -1
  69. package/module/Object/removePrototype.d.ts +15 -0
  70. package/module/Object/removePrototype.js +25 -0
  71. package/module/Object/removePrototype.js.map +1 -0
  72. package/module/Object/removePrototypeDeep.d.ts +11 -0
  73. package/module/Object/removePrototypeDeep.js +60 -0
  74. package/module/Object/removePrototypeDeep.js.map +1 -0
  75. package/module/Object/removePrototypeMap.d.ts +9 -0
  76. package/module/Object/removePrototypeMap.js +13 -0
  77. package/module/Object/removePrototypeMap.js.map +1 -0
  78. package/module/Object/removePrototypeMapDeep.d.ts +9 -0
  79. package/module/Object/removePrototypeMapDeep.js +13 -0
  80. package/module/Object/removePrototypeMapDeep.js.map +1 -0
  81. package/module/String/escapeHtml.js +11 -2
  82. package/module/String/escapeHtml.js.map +1 -1
  83. package/module/String/formatString/applyFormatter.js +5 -5
  84. package/module/String/formatString/applyFormatter.js.map +1 -1
  85. package/module/String/formatString/getValue.js +3 -1
  86. package/module/String/formatString/getValue.js.map +1 -1
  87. package/module/String/levenshteinDistance.js +41 -24
  88. package/module/String/levenshteinDistance.js.map +1 -1
  89. package/module/String/slugify.js +7 -5
  90. package/module/String/slugify.js.map +1 -1
  91. package/module/String/trimEndCharacters.js +3 -1
  92. package/module/String/trimEndCharacters.js.map +1 -1
  93. package/module/String/trimStartCharacters.js +3 -1
  94. package/module/String/trimStartCharacters.js.map +1 -1
  95. package/module/String/unescapeHtml.d.ts +1 -1
  96. package/module/String/unescapeHtml.js +48 -4
  97. package/module/String/unescapeHtml.js.map +1 -1
  98. package/module/Tool/parseJson.js +13 -1
  99. package/module/Tool/parseJson.js.map +1 -1
  100. package/module/URL/buildUrl.js +4 -0
  101. package/module/URL/buildUrl.js.map +1 -1
  102. package/module/URL/parseQueryString.js +4 -0
  103. package/module/URL/parseQueryString.js.map +1 -1
  104. package/module/Validate/isDeepEqual.js +7 -5
  105. package/module/Validate/isDeepEqual.js.map +1 -1
  106. package/module/Validate/isPrimeNumber.js +12 -2
  107. package/module/Validate/isPrimeNumber.js.map +1 -1
  108. package/module/Validate/object/index.d.ts +2 -0
  109. package/module/Validate/object/index.js +2 -0
  110. package/module/Validate/object/index.js.map +1 -1
  111. package/module/Validate/object/intersection.d.ts +10 -0
  112. package/module/Validate/object/intersection.js +25 -0
  113. package/module/Validate/object/intersection.js.map +1 -0
  114. package/module/Validate/object/optional.d.ts +6 -0
  115. package/module/Validate/object/optional.js +6 -0
  116. package/module/Validate/object/optional.js.map +1 -1
  117. package/module/Validate/object/union.d.ts +9 -0
  118. package/module/Validate/object/union.js +27 -0
  119. package/module/Validate/object/union.js.map +1 -0
  120. package/module/Validate/parseEmail.js +6 -0
  121. package/module/Validate/parseEmail.js.map +1 -1
  122. package/module/Validate/string/uuid.d.ts +1 -5
  123. package/module/Validate/string/uuid.js +19 -2
  124. package/module/Validate/string/uuid.js.map +1 -1
  125. package/module/es5/Array/arraysJoin.js +20 -2
  126. package/module/es5/Array/sum.js +38 -4
  127. package/module/es5/Array/ultraNumberSort.js +31 -45
  128. package/module/es5/Array/zip.js +23 -17
  129. package/module/es5/Array/zipLongest.js +27 -14
  130. package/module/es5/Crypto/decodeBase32.js +11 -2
  131. package/module/es5/Crypto/decodeBase58.js +13 -6
  132. package/module/es5/Crypto/encodeBase32.js +12 -6
  133. package/module/es5/Crypto/encodeBase58.js +6 -2
  134. package/module/es5/DataStructure/priorityQueue.js +8 -3
  135. package/module/es5/IP/ipToBinaryString.js +2 -2
  136. package/module/es5/IP/longToIp.d.ts +1 -1
  137. package/module/es5/IP/longToIp.js +2 -13
  138. package/module/es5/Math/addition.js +4 -13
  139. package/module/es5/Math/multiplication.js +37 -6
  140. package/module/es5/Math/nCr.js +7 -2
  141. package/module/es5/Math/standardDeviation.js +25 -10
  142. package/module/es5/Math/subtract.js +12 -9
  143. package/module/es5/Object/deepClone.d.ts +10 -0
  144. package/module/es5/Object/deepClone.js +16 -6
  145. package/module/es5/Object/getObjectsCommon.d.ts +10 -0
  146. package/module/es5/Object/getObjectsCommon.js +10 -0
  147. package/module/es5/Object/getObjectsDiff.d.ts +10 -0
  148. package/module/es5/Object/getObjectsDiff.js +32 -17
  149. package/module/es5/Object/has.d.ts +10 -0
  150. package/module/es5/Object/has.js +10 -0
  151. package/module/es5/Object/index.d.ts +4 -0
  152. package/module/es5/Object/index.js +44 -0
  153. package/module/es5/Object/keyBy.d.ts +10 -0
  154. package/module/es5/Object/keyBy.js +10 -0
  155. package/module/es5/Object/mapKeys.d.ts +10 -0
  156. package/module/es5/Object/mapKeys.js +12 -1
  157. package/module/es5/Object/mapValues.d.ts +10 -0
  158. package/module/es5/Object/mapValues.js +10 -0
  159. package/module/es5/Object/merge.d.ts +10 -0
  160. package/module/es5/Object/merge.js +19 -1
  161. package/module/es5/Object/mergeDeep.d.ts +10 -0
  162. package/module/es5/Object/mergeDeep.js +34 -18
  163. package/module/es5/Object/pickDeep.d.ts +10 -0
  164. package/module/es5/Object/pickDeep.js +10 -3
  165. package/module/es5/Object/removePrototype.d.ts +15 -0
  166. package/module/es5/Object/removePrototype.js +31 -0
  167. package/module/es5/Object/removePrototypeDeep.d.ts +11 -0
  168. package/module/es5/Object/removePrototypeDeep.js +81 -0
  169. package/module/es5/Object/removePrototypeMap.d.ts +9 -0
  170. package/module/es5/Object/removePrototypeMap.js +20 -0
  171. package/module/es5/Object/removePrototypeMapDeep.d.ts +9 -0
  172. package/module/es5/Object/removePrototypeMapDeep.js +20 -0
  173. package/module/es5/String/escapeHtml.js +12 -3
  174. package/module/es5/String/formatString/applyFormatter.js +5 -5
  175. package/module/es5/String/formatString/getValue.js +4 -1
  176. package/module/es5/String/levenshteinDistance.js +43 -28
  177. package/module/es5/String/slugify.js +8 -1
  178. package/module/es5/String/trimEndCharacters.js +3 -1
  179. package/module/es5/String/trimStartCharacters.js +3 -1
  180. package/module/es5/String/unescapeHtml.d.ts +1 -1
  181. package/module/es5/String/unescapeHtml.js +46 -4
  182. package/module/es5/Tool/parseJson.js +14 -1
  183. package/module/es5/URL/buildUrl.js +4 -0
  184. package/module/es5/URL/parseQueryString.js +4 -0
  185. package/module/es5/Validate/isDeepEqual.js +48 -39
  186. package/module/es5/Validate/isPrimeNumber.js +14 -2
  187. package/module/es5/Validate/object/index.d.ts +2 -0
  188. package/module/es5/Validate/object/index.js +22 -0
  189. package/module/es5/Validate/object/intersection.d.ts +10 -0
  190. package/module/es5/Validate/object/intersection.js +34 -0
  191. package/module/es5/Validate/object/optional.d.ts +6 -0
  192. package/module/es5/Validate/object/optional.js +6 -0
  193. package/module/es5/Validate/object/union.d.ts +9 -0
  194. package/module/es5/Validate/object/union.js +36 -0
  195. package/module/es5/Validate/parseEmail.js +8 -0
  196. package/module/es5/Validate/string/uuid.d.ts +1 -5
  197. package/module/es5/Validate/string/uuid.js +24 -2
  198. package/package.json +33 -28
  199. package/module/es5/tsconfig.tsbuildinfo +0 -1
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.zip = void 0;
7
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
- 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."); }
9
- 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; } }
10
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
- 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; }
13
7
  /**
14
8
  * Creates a new array by combining elements from multiple arrays at corresponding positions
15
9
  * @param {T} arrays List of arrays to combine
@@ -22,17 +16,29 @@ var zip = exports.zip = function zip() {
22
16
  for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
23
17
  arrays[_key] = arguments[_key];
24
18
  }
25
- if (arrays.length === 0) {
19
+ var arraysLength = arrays.length;
20
+ if (arraysLength === 0) {
26
21
  return [];
27
22
  }
28
- var length = Math.min.apply(Math, _toConsumableArray(arrays.map(function (array) {
29
- return array.length;
30
- })));
31
- return Array.from({
32
- length: length
33
- }, function (_, index) {
34
- return arrays.map(function (array) {
35
- return array[index];
36
- });
37
- });
23
+
24
+ // Optimize: Avoid Math.min(...arrays.map(...)) to prevent Call Stack Size Exceeded errors
25
+ // for a large number of arrays, and avoid intermediate array allocations.
26
+ var minLength = arrays[0].length;
27
+ for (var index = 1; index < arraysLength; index += 1) {
28
+ if (arrays[index].length < minLength) {
29
+ minLength = arrays[index].length;
30
+ }
31
+ }
32
+
33
+ // Optimize: Pre-allocate outer array dynamically using loops rather than Array.from
34
+ // to reduce closure creation overhead and eliminate intermediate mapped arrays.
35
+ var result = [];
36
+ for (var _index = 0; _index < minLength; _index += 1) {
37
+ var tuple = [];
38
+ for (var arrayIndex = 0; arrayIndex < arraysLength; arrayIndex += 1) {
39
+ tuple.push(arrays[arrayIndex][_index]);
40
+ }
41
+ result.push(tuple);
42
+ }
43
+ return result;
38
44
  };
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.zipLongest = void 0;
7
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
- 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."); }
9
- 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; } }
10
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
- 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; }
13
7
  /**
14
8
  * Combines arrays of different lengths by padding shorter arrays with undefined values
15
9
  * to match the length of the longest array
@@ -25,14 +19,33 @@ var zipLongest = exports.zipLongest = function zipLongest() {
25
19
  for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
26
20
  arrays[_key] = arguments[_key];
27
21
  }
28
- var maxLength = Math.max.apply(Math, _toConsumableArray(arrays.map(function (array) {
29
- return array.length;
30
- })));
31
- return Array.from({
22
+ var arraysLength = arrays.length;
23
+ if (arraysLength === 0) {
24
+ return [];
25
+ }
26
+
27
+ // Optimize: Avoid Math.max(...arrays.map(...)) to prevent Call Stack Size Exceeded errors
28
+ // for a large number of arrays, and avoid intermediate array allocations.
29
+ var maxLength = arrays[0].length;
30
+ for (var index = 1; index < arraysLength; index += 1) {
31
+ if (arrays[index].length > maxLength) {
32
+ maxLength = arrays[index].length;
33
+ }
34
+ }
35
+
36
+ // Optimize: Pre-allocate arrays with known lengths and use direct index assignment
37
+ // instead of .push() to avoid repeated capacity checks and potential reallocations.
38
+ var result = Array.from({
32
39
  length: maxLength
33
- }, function (_, index) {
34
- return arrays.map(function (array) {
35
- return array[index];
36
- });
37
40
  });
41
+ for (var _index = 0; _index < maxLength; _index += 1) {
42
+ var tuple = Array.from({
43
+ length: arraysLength
44
+ });
45
+ for (var arrayIndex = 0; arrayIndex < arraysLength; arrayIndex += 1) {
46
+ tuple[arrayIndex] = arrays[arrayIndex][_index];
47
+ }
48
+ result[_index] = tuple;
49
+ }
50
+ return result;
38
51
  };
@@ -6,8 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.decodeBase32 = void 0;
7
7
  var _constants = require("./constants");
8
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."); }
9
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); }
10
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; }
15
+ // O(1) lookup table for Base32 character-to-index mapping
16
+ var base32CharToIndex = new Map(_toConsumableArray(_constants.BASE32_ALPHABET).map(function (c, index) {
17
+ return [c, index];
18
+ }));
19
+
11
20
  /**
12
21
  * Decodes a Base32 string to Uint8Array
13
22
  * @param {string} input - Base32 encoded string
@@ -15,7 +24,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
15
24
  * @example decodeBase32("JBSWY3DP"); // Uint8Array for "Hello"
16
25
  */
17
26
  var decodeBase32 = exports.decodeBase32 = function decodeBase32(input) {
18
- var alphabet = _constants.BASE32_ALPHABET;
19
27
  var cleanedInput = input.replaceAll("=", "");
20
28
  var result = [];
21
29
  var buffer = 0;
@@ -24,8 +32,9 @@ var decodeBase32 = exports.decodeBase32 = function decodeBase32(input) {
24
32
  _step;
25
33
  try {
26
34
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
35
+ var _base32CharToIndex$ge;
27
36
  var _char = _step.value;
28
- var value = alphabet.indexOf(_char);
37
+ var value = (_base32CharToIndex$ge = base32CharToIndex.get(_char)) !== null && _base32CharToIndex$ge !== void 0 ? _base32CharToIndex$ge : 0;
29
38
  buffer = buffer << 5 | value;
30
39
  bufferLength += 5;
31
40
  if (bufferLength >= 8) {
@@ -5,13 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.decodeBase58 = void 0;
7
7
  var _constants = require("./constants");
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; } } }; }
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."); }
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; } }
10
12
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
13
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
- 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; } } }; }
13
- 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; } }
14
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; }
15
+ // O(1) lookup table for Base58 character-to-index mapping
16
+ var base58CharToIndex = new Map(_toConsumableArray(_constants.BASE58_ALPHABET).map(function (c, index) {
17
+ return [c, index];
18
+ }));
19
+
15
20
  /**
16
21
  * Decodes a Base58 string to Uint8Array
17
22
  * @param {string} input - Base58 encoded string
@@ -19,16 +24,17 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
19
24
  * @example decodeBase58("9Ajdvzr"); // Uint8Array for "Hello"
20
25
  */
21
26
  var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
22
- var alphabet = _constants.BASE58_ALPHABET;
23
27
  var bigNumber = 0n;
24
28
  var _iterator = _createForOfIteratorHelper(input),
25
29
  _step;
26
30
  try {
27
31
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
32
+ var _base58CharToIndex$ge;
28
33
  var _char = _step.value;
29
- var value = alphabet.indexOf(_char);
30
- bigNumber = bigNumber * 58n + BigInt(value);
34
+ bigNumber = bigNumber * 58n + BigInt((_base58CharToIndex$ge = base58CharToIndex.get(_char)) !== null && _base58CharToIndex$ge !== void 0 ? _base58CharToIndex$ge : 0);
31
35
  }
36
+
37
+ // Use push + reverse instead of unshift to avoid O(n²) array shifting
32
38
  } catch (err) {
33
39
  _iterator.e(err);
34
40
  } finally {
@@ -36,9 +42,10 @@ var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
36
42
  }
37
43
  var bytes = [];
38
44
  while (bigNumber > 0) {
39
- bytes.unshift(Number(bigNumber % 256n));
45
+ bytes.push(Number(bigNumber % 256n));
40
46
  bigNumber /= 256n;
41
47
  }
48
+ bytes.reverse();
42
49
  var leadingOnes = 0;
43
50
  var _iterator2 = _createForOfIteratorHelper(input),
44
51
  _step2;
@@ -17,7 +17,11 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
17
17
  var encodeBase32 = exports.encodeBase32 = function encodeBase32(input) {
18
18
  var alphabet = _constants.BASE32_ALPHABET;
19
19
  var bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
20
- var result = "";
20
+
21
+ // Performance: collect characters in an array and join at the end instead of
22
+ // repeated string concatenation, which copies the entire string on every +=
23
+ // and is O(n²) for large inputs. Array push + join is O(n).
24
+ var chars = [];
21
25
  var buffer = 0;
22
26
  var bufferLength = 0;
23
27
  var _iterator = _createForOfIteratorHelper(bytes),
@@ -29,7 +33,7 @@ var encodeBase32 = exports.encodeBase32 = function encodeBase32(input) {
29
33
  bufferLength += 8;
30
34
  while (bufferLength >= 5) {
31
35
  bufferLength -= 5;
32
- result += alphabet[buffer >> bufferLength & 0x1f];
36
+ chars.push(alphabet[buffer >> bufferLength & 0x1f]);
33
37
  }
34
38
  }
35
39
  } catch (err) {
@@ -38,9 +42,11 @@ var encodeBase32 = exports.encodeBase32 = function encodeBase32(input) {
38
42
  _iterator.f();
39
43
  }
40
44
  if (bufferLength > 0) {
41
- result += alphabet[buffer << 5 - bufferLength & 0x1f];
45
+ chars.push(alphabet[buffer << 5 - bufferLength & 0x1f]);
46
+ }
47
+ var paddingLength = (8 - chars.length % 8) % 8;
48
+ if (paddingLength > 0) {
49
+ chars.push("=".repeat(paddingLength));
42
50
  }
43
- var paddingLength = (8 - result.length % 8) % 8;
44
- result += "=".repeat(paddingLength);
45
- return result;
51
+ return chars.join("");
46
52
  };
@@ -17,7 +17,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
17
17
  var encodeBase58 = exports.encodeBase58 = function encodeBase58(input) {
18
18
  var alphabet = _constants.BASE58_ALPHABET;
19
19
  var bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
20
- var encoded = "";
20
+
21
+ // Use array + reverse + join instead of string prepend to avoid O(n²) string concatenation
22
+ var chars = [];
21
23
  var bigNumber = 0n;
22
24
  var _iterator = _createForOfIteratorHelper(bytes),
23
25
  _step;
@@ -33,9 +35,11 @@ var encodeBase58 = exports.encodeBase58 = function encodeBase58(input) {
33
35
  }
34
36
  while (bigNumber > 0) {
35
37
  var remainder = Number(bigNumber % 58n);
36
- encoded = alphabet[remainder] + encoded;
38
+ chars.push(alphabet[remainder]);
37
39
  bigNumber /= 58n;
38
40
  }
41
+ chars.reverse();
42
+ var encoded = chars.join("");
39
43
  var leadingZeros = 0;
40
44
  var _iterator2 = _createForOfIteratorHelper(bytes),
41
45
  _step2;
@@ -330,9 +330,14 @@ var PriorityQueue = exports.PriorityQueue = /*#__PURE__*/function () {
330
330
  this.minPriority = 0;
331
331
  return;
332
332
  }
333
- this.minPriority = Math.min.apply(Math, _toConsumableArray(this.heap.map(function (item) {
334
- return item.priority;
335
- })));
333
+ // Single-pass minimum without intermediate array allocation
334
+ var min = this.heap[0].priority;
335
+ for (var index = 1; index < this.heap.length; index++) {
336
+ if (this.heap[index].priority < min) {
337
+ min = this.heap[index].priority;
338
+ }
339
+ }
340
+ this.minPriority = min;
336
341
  }
337
342
 
338
343
  /**
@@ -10,7 +10,7 @@ exports.ipToBinaryString = void 0;
10
10
  * @returns {string} Binary string representation (32 bits)
11
11
  */
12
12
  var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip) {
13
- return ip.split(".").map(function (octet) {
14
- return Number.parseInt(octet, 10).toString(2).padStart(8, "0");
13
+ return ip.split(".").map(function (part) {
14
+ return Number.parseInt(part, 10).toString(2).padStart(8, "0");
15
15
  }).join("");
16
16
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Converts a 32-bit number to an IPv4 address
3
- * @param {number} long - 32-bit unsigned integer to convert
3
+ * @param {number} long - 32-bit unsigned integer to convert (0 to 4294967295)
4
4
  * @returns {string} IPv4 address (e.g., "192.168.1.1")
5
5
  */
6
6
  export declare const longToIp: (long: number) => string;
@@ -6,20 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.longToIp = void 0;
7
7
  /**
8
8
  * Converts a 32-bit number to an IPv4 address
9
- * @param {number} long - 32-bit unsigned integer to convert
9
+ * @param {number} long - 32-bit unsigned integer to convert (0 to 4294967295)
10
10
  * @returns {string} IPv4 address (e.g., "192.168.1.1")
11
11
  */
12
12
  var longToIp = exports.longToIp = function longToIp(_long) {
13
- // Convert to binary string and ensure 32-bit length
14
- var binary = _long.toString(2).padStart(32, "0");
15
-
16
- // Split into octets and convert to decimal
17
- var octets = Array.from({
18
- length: 4
19
- }, function (_, index) {
20
- return Number.parseInt(binary.slice(index * 8, (index + 1) * 8), 2);
21
- });
22
-
23
- // Join octets with dots
24
- return octets.join(".");
13
+ return "".concat(_long >>> 24 & 0xff, ".").concat(_long >>> 16 & 0xff, ".").concat(_long >>> 8 & 0xff, ".").concat(_long & 0xff);
25
14
  };
@@ -13,30 +13,21 @@ var _getDecimalLength = require("./getDecimalLength");
13
13
  */
14
14
  var addition = exports.addition = function addition() {
15
15
  var maxDecimal = 0;
16
- var allIntegers = true;
17
16
  for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
18
17
  numbers[_key] = arguments[_key];
19
18
  }
20
19
  for (var _i = 0, _numbers = numbers; _i < _numbers.length; _i++) {
21
20
  var number = _numbers[_i];
22
- if (!Number.isInteger(number)) {
23
- allIntegers = false;
24
- var length = (0, _getDecimalLength.getDecimalLength)(number);
25
- if (length > maxDecimal) {
26
- maxDecimal = length;
27
- }
21
+ var length = (0, _getDecimalLength.getDecimalLength)(number);
22
+ if (length > maxDecimal) {
23
+ maxDecimal = length;
28
24
  }
29
25
  }
30
- if (allIntegers || maxDecimal === 0) {
31
- return numbers.reduce(function (sum, current) {
32
- return sum + current;
33
- }, 0);
34
- }
35
26
  var z = Math.pow(10, maxDecimal);
36
27
  var sum = 0;
37
28
  for (var _i2 = 0, _numbers2 = numbers; _i2 < _numbers2.length; _i2++) {
38
29
  var _number = _numbers2[_i2];
39
- sum += Math.round(_number * z);
30
+ sum += maxDecimal === 0 ? _number : Math.round(_number * z);
40
31
  }
41
32
  return sum / z;
42
33
  };
@@ -4,7 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.multiplication = void 0;
7
+ var _addition = require("./addition");
7
8
  var _getDecimalLength = require("./getDecimalLength");
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 _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); }
13
+ 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; } } }; }
14
+ 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; } }
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; }
16
+ var multiplyIntegers = function multiplyIntegers(numbers) {
17
+ var product = 1;
18
+ var _iterator = _createForOfIteratorHelper(numbers),
19
+ _step;
20
+ try {
21
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
+ var n = _step.value;
23
+ product *= n;
24
+ }
25
+ } catch (err) {
26
+ _iterator.e(err);
27
+ } finally {
28
+ _iterator.f();
29
+ }
30
+ return product;
31
+ };
32
+
8
33
  /**
9
34
  * Performs multiplication without floating point errors for any number of arguments
10
35
  * @param {...number[]} numbers Numbers to multiply
@@ -15,10 +40,16 @@ var multiplication = exports.multiplication = function multiplication() {
15
40
  for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
16
41
  numbers[_key] = arguments[_key];
17
42
  }
18
- return numbers.reduce(function (accumulator, number) {
19
- var n = Math.pow(10, (0, _getDecimalLength.getDecimalLength)(accumulator) + (0, _getDecimalLength.getDecimalLength)(number));
20
- var accumulatorWithoutDot = +"".concat(accumulator).replace(".", "");
21
- var numberWithoutDot = +"".concat(number).replace(".", "");
22
- return accumulatorWithoutDot * numberWithoutDot / n;
23
- }, 1);
43
+ if (numbers.every(function (n) {
44
+ return Number.isInteger(n);
45
+ })) {
46
+ return multiplyIntegers(numbers);
47
+ }
48
+ var integers = numbers.map(function (n) {
49
+ return +"".concat(n).replace(".", "");
50
+ });
51
+ var totalDecimal = _addition.addition.apply(void 0, _toConsumableArray(numbers.map(function (n) {
52
+ return (0, _getDecimalLength.getDecimalLength)(n);
53
+ })));
54
+ return multiplyIntegers(integers) / Math.pow(10, totalDecimal);
24
55
  };
@@ -23,8 +23,13 @@ var nCr = exports.nCr = function nCr(n, r) {
23
23
  if (r === 0 || n === r) {
24
24
  return 1;
25
25
  }
26
- var numerator = (0, _nPr.nPr)(n, r);
27
- var denominator = (0, _factorial.factorial)(r);
26
+
27
+ // Performance: use symmetry property nCr(n, r) = nCr(n, n-r) to
28
+ // minimize the number of multiplications when r > n/2.
29
+ // e.g. nCr(100, 97) becomes nCr(100, 3), reducing 193 multiplications to 5.
30
+ var effectiveR = Math.min(r, n - r);
31
+ var numerator = (0, _nPr.nPr)(n, effectiveR);
32
+ var denominator = (0, _factorial.factorial)(effectiveR);
28
33
  var result = numerator / denominator;
29
34
  return result;
30
35
  };
@@ -5,8 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.standardDeviation = void 0;
7
7
  var _average = require("./average");
8
+ var _addition = require("../Math/addition");
9
+ var _division = require("../Math/division");
8
10
  var _multiplication = require("../Math/multiplication");
9
11
  var _subtract = require("../Math/subtract");
12
+ 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; } } }; }
13
+ 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; } }
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
  * Calculates the standard deviation of a set of values
12
17
  * @param {number[]} values Array of numeric values
@@ -19,17 +24,27 @@ var _subtract = require("../Math/subtract");
19
24
  * while a high standard deviation indicates that the values are spread out over a wider range.
20
25
  */
21
26
  var standardDeviation = exports.standardDeviation = function standardDeviation(values) {
27
+ if (values.length === 0) {
28
+ return 0;
29
+ }
22
30
  var avg = (0, _average.average)(values);
23
31
 
24
- // Calculate the squared differences from the mean
25
- var squareDiffs = values.map(function (value) {
26
- var diff = (0, _subtract.subtract)(value, avg);
27
- return (0, _multiplication.multiplication)(diff, diff);
28
- });
29
-
30
- // Calculate the mean of the squared differences
31
- var avgSquareDiff = (0, _average.average)(squareDiffs);
32
-
33
- // Return the square root of the mean squared differences
32
+ // Accumulate sum of squared differences in a single pass,
33
+ // avoiding an intermediate array allocation and extra traversal
34
+ var sumSquareDiffs = 0;
35
+ var _iterator = _createForOfIteratorHelper(values),
36
+ _step;
37
+ try {
38
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
39
+ var value = _step.value;
40
+ var diff = (0, _subtract.subtract)(value, avg);
41
+ sumSquareDiffs = (0, _addition.addition)(sumSquareDiffs, (0, _multiplication.multiplication)(diff, diff));
42
+ }
43
+ } catch (err) {
44
+ _iterator.e(err);
45
+ } finally {
46
+ _iterator.f();
47
+ }
48
+ var avgSquareDiff = (0, _division.division)(sumSquareDiffs, values.length);
34
49
  return Math.sqrt(avgSquareDiff);
35
50
  };
@@ -4,9 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.subtract = void 0;
7
+ var _addition = require("./addition");
7
8
  var _getDecimalLength = require("./getDecimalLength");
8
9
  var _max = require("./max");
9
10
  var _multiplication = require("./multiplication");
11
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
12
+ 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."); }
13
+ 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; } }
14
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
15
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
16
+ 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
17
  /**
11
18
  * Performs subtraction with arbitrary number of arguments without floating point errors
12
19
  * @param {number[]} numbers Array of numbers to subtract
@@ -24,13 +31,9 @@ var subtract = exports.subtract = function subtract() {
24
31
  for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
25
32
  numbers[_key] = arguments[_key];
26
33
  }
27
- return numbers.reduce(function (accumulator, current, index) {
28
- if (index === 0) {
29
- return current;
30
- }
31
- // Get the power of 10 based on the maximum decimal places
32
- var z = Math.pow(10, (0, _max.max)((0, _getDecimalLength.getDecimalLength)(accumulator), (0, _getDecimalLength.getDecimalLength)(current)));
33
- // Scale to integers, subtract, then scale back to original decimal places
34
- return ((0, _multiplication.multiplication)(accumulator, z) - (0, _multiplication.multiplication)(current, z)) / z;
35
- }, 0);
34
+ var first = numbers[0],
35
+ rest = _arrayLikeToArray(numbers).slice(1);
36
+ var restSum = _addition.addition.apply(void 0, _toConsumableArray(rest));
37
+ var z = Math.pow(10, (0, _max.max)((0, _getDecimalLength.getDecimalLength)(first), (0, _getDecimalLength.getDecimalLength)(restSum)));
38
+ return ((0, _multiplication.multiplication)(first, z) - (0, _multiplication.multiplication)(restSum, z)) / z;
36
39
  };
@@ -11,5 +11,15 @@
11
11
  * cloned.b.c = 99;
12
12
  * original.b.c; // still 2
13
13
  * ```
14
+ *
15
+ * @remarks
16
+ * **Prototype pollution warning:** This function does not filter out
17
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
18
+ * If processing user-controlled input, sanitize with the appropriate
19
+ * `removePrototype*` helper before calling this function:
20
+ * - `removePrototype` — shallow sanitization of a single object
21
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
22
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
23
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
14
24
  */
15
25
  export declare const deepClone: <T>(value: T) => T;
@@ -15,7 +15,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
15
15
  /**
16
16
  * Recursively clones a value.
17
17
  */
18
- var _cloneValue = function cloneValue(value) {
18
+ var _cloneValue = function cloneValue(value, depth) {
19
19
  if (value === null || _typeof(value) !== "object") {
20
20
  return value;
21
21
  }
@@ -26,7 +26,7 @@ var _cloneValue = function cloneValue(value) {
26
26
  try {
27
27
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
28
28
  var element = _step.value;
29
- _result.push(_cloneValue(element));
29
+ _result.push(_cloneValue(element, depth + 1));
30
30
  }
31
31
  } catch (err) {
32
32
  _iterator.e(err);
@@ -50,7 +50,7 @@ var _cloneValue = function cloneValue(value) {
50
50
  var _step2$value = _slicedToArray(_step2.value, 2),
51
51
  k = _step2$value[0],
52
52
  v = _step2$value[1];
53
- _result2.set(_cloneValue(k), _cloneValue(v));
53
+ _result2.set(_cloneValue(k, depth + 1), _cloneValue(v, depth + 1));
54
54
  }
55
55
  } catch (err) {
56
56
  _iterator2.e(err);
@@ -66,7 +66,7 @@ var _cloneValue = function cloneValue(value) {
66
66
  try {
67
67
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
68
68
  var _v = _step3.value;
69
- _result3.add(_cloneValue(_v));
69
+ _result3.add(_cloneValue(_v, depth + 1));
70
70
  }
71
71
  } catch (err) {
72
72
  _iterator3.e(err);
@@ -80,7 +80,7 @@ var _cloneValue = function cloneValue(value) {
80
80
  var result = {};
81
81
  for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
82
82
  var key = _Object$keys[_i];
83
- result[key] = _cloneValue(value[key]);
83
+ result[key] = _cloneValue(value[key], depth + 1);
84
84
  }
85
85
  return result;
86
86
  };
@@ -98,10 +98,20 @@ var _cloneValue = function cloneValue(value) {
98
98
  * cloned.b.c = 99;
99
99
  * original.b.c; // still 2
100
100
  * ```
101
+ *
102
+ * @remarks
103
+ * **Prototype pollution warning:** This function does not filter out
104
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
105
+ * If processing user-controlled input, sanitize with the appropriate
106
+ * `removePrototype*` helper before calling this function:
107
+ * - `removePrototype` — shallow sanitization of a single object
108
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
109
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
110
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
101
111
  */
102
112
  var deepClone = exports.deepClone = function deepClone(value) {
103
113
  if (value === null || _typeof(value) !== "object") {
104
114
  return value;
105
115
  }
106
- return _cloneValue(value);
116
+ return _cloneValue(value, 0);
107
117
  };
@@ -11,6 +11,16 @@
11
11
  * @param {...Record<string, unknown>[]} objects - Additional objects to compare.
12
12
  * @returns {Partial<T>} Object containing only the key-value pairs shared by all inputs.
13
13
  *
14
+ * @remarks
15
+ * **Prototype pollution warning:** This function does not filter out
16
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
17
+ * If processing user-controlled input, sanitize with the appropriate
18
+ * `removePrototype*` helper before calling this function:
19
+ * - `removePrototype` — shallow sanitization of a single object
20
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
21
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
22
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
23
+ *
14
24
  * @example
15
25
  * ```typescript
16
26
  * getObjectsCommon({ a: 1, b: 2 }, { a: 1, c: 3 });