umt 2.14.0 → 2.16.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 (196) 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/zip.js +21 -5
  6. package/module/Array/zip.js.map +1 -1
  7. package/module/Array/zipLongest.js +23 -4
  8. package/module/Array/zipLongest.js.map +1 -1
  9. package/module/Crypto/decodeBase32.js.map +1 -1
  10. package/module/Crypto/decodeBase58.js +1 -2
  11. package/module/Crypto/decodeBase58.js.map +1 -1
  12. package/module/Crypto/encodeBase32.js +11 -6
  13. package/module/Crypto/encodeBase32.js.map +1 -1
  14. package/module/DataStructure/priorityQueue.js +8 -1
  15. package/module/DataStructure/priorityQueue.js.map +1 -1
  16. package/module/IP/ipToBinaryString.js +3 -1
  17. package/module/IP/ipToBinaryString.js.map +1 -1
  18. package/module/IP/longToIp.d.ts +1 -1
  19. package/module/IP/longToIp.js +2 -7
  20. package/module/IP/longToIp.js.map +1 -1
  21. package/module/Math/addition.js +4 -11
  22. package/module/Math/addition.js.map +1 -1
  23. package/module/Math/multiplication.js +14 -6
  24. package/module/Math/multiplication.js.map +1 -1
  25. package/module/Math/nCr.js +6 -2
  26. package/module/Math/nCr.js.map +1 -1
  27. package/module/Math/standardDeviation.js +12 -7
  28. package/module/Math/standardDeviation.js.map +1 -1
  29. package/module/Math/subtract.js +5 -9
  30. package/module/Math/subtract.js.map +1 -1
  31. package/module/Object/deepClone.d.ts +10 -0
  32. package/module/Object/deepClone.js +16 -9
  33. package/module/Object/deepClone.js.map +1 -1
  34. package/module/Object/getObjectsCommon.d.ts +10 -0
  35. package/module/Object/getObjectsCommon.js +10 -0
  36. package/module/Object/getObjectsCommon.js.map +1 -1
  37. package/module/Object/getObjectsDiff.d.ts +10 -0
  38. package/module/Object/getObjectsDiff.js +17 -6
  39. package/module/Object/getObjectsDiff.js.map +1 -1
  40. package/module/Object/has.d.ts +10 -0
  41. package/module/Object/has.js +13 -2
  42. package/module/Object/has.js.map +1 -1
  43. package/module/Object/index.d.ts +4 -0
  44. package/module/Object/index.js +4 -0
  45. package/module/Object/index.js.map +1 -1
  46. package/module/Object/keyBy.d.ts +10 -0
  47. package/module/Object/keyBy.js +10 -0
  48. package/module/Object/keyBy.js.map +1 -1
  49. package/module/Object/mapKeys.d.ts +10 -0
  50. package/module/Object/mapKeys.js +12 -1
  51. package/module/Object/mapKeys.js.map +1 -1
  52. package/module/Object/mapValues.d.ts +10 -0
  53. package/module/Object/mapValues.js +10 -0
  54. package/module/Object/mapValues.js.map +1 -1
  55. package/module/Object/merge.d.ts +10 -0
  56. package/module/Object/merge.js +17 -1
  57. package/module/Object/merge.js.map +1 -1
  58. package/module/Object/mergeDeep.d.ts +10 -0
  59. package/module/Object/mergeDeep.js +29 -15
  60. package/module/Object/mergeDeep.js.map +1 -1
  61. package/module/Object/pick.d.ts +10 -0
  62. package/module/Object/pick.js +10 -0
  63. package/module/Object/pick.js.map +1 -1
  64. package/module/Object/pickDeep.d.ts +10 -0
  65. package/module/Object/pickDeep.js +10 -5
  66. package/module/Object/pickDeep.js.map +1 -1
  67. package/module/Object/removePrototype.d.ts +15 -0
  68. package/module/Object/removePrototype.js +25 -0
  69. package/module/Object/removePrototype.js.map +1 -0
  70. package/module/Object/removePrototypeDeep.d.ts +11 -0
  71. package/module/Object/removePrototypeDeep.js +60 -0
  72. package/module/Object/removePrototypeDeep.js.map +1 -0
  73. package/module/Object/removePrototypeMap.d.ts +9 -0
  74. package/module/Object/removePrototypeMap.js +13 -0
  75. package/module/Object/removePrototypeMap.js.map +1 -0
  76. package/module/Object/removePrototypeMapDeep.d.ts +9 -0
  77. package/module/Object/removePrototypeMapDeep.js +13 -0
  78. package/module/Object/removePrototypeMapDeep.js.map +1 -0
  79. package/module/String/escapeHtml.js +11 -2
  80. package/module/String/escapeHtml.js.map +1 -1
  81. package/module/String/formatString/applyFormatter.js +5 -5
  82. package/module/String/formatString/applyFormatter.js.map +1 -1
  83. package/module/String/formatString/getValue.js +3 -1
  84. package/module/String/formatString/getValue.js.map +1 -1
  85. package/module/String/levenshteinDistance.js +41 -24
  86. package/module/String/levenshteinDistance.js.map +1 -1
  87. package/module/String/slugify.js +7 -5
  88. package/module/String/slugify.js.map +1 -1
  89. package/module/String/trimEndCharacters.js +3 -1
  90. package/module/String/trimEndCharacters.js.map +1 -1
  91. package/module/String/trimStartCharacters.js +3 -1
  92. package/module/String/trimStartCharacters.js.map +1 -1
  93. package/module/String/unescapeHtml.d.ts +1 -1
  94. package/module/String/unescapeHtml.js +48 -4
  95. package/module/String/unescapeHtml.js.map +1 -1
  96. package/module/Tool/parseJson.js +13 -1
  97. package/module/Tool/parseJson.js.map +1 -1
  98. package/module/URL/buildUrl.js +4 -0
  99. package/module/URL/buildUrl.js.map +1 -1
  100. package/module/URL/parseQueryString.js +4 -0
  101. package/module/URL/parseQueryString.js.map +1 -1
  102. package/module/Validate/isDeepEqual.js +7 -5
  103. package/module/Validate/isDeepEqual.js.map +1 -1
  104. package/module/Validate/isPrimeNumber.js +12 -2
  105. package/module/Validate/isPrimeNumber.js.map +1 -1
  106. package/module/Validate/object/index.d.ts +2 -0
  107. package/module/Validate/object/index.js +2 -0
  108. package/module/Validate/object/index.js.map +1 -1
  109. package/module/Validate/object/intersection.d.ts +10 -0
  110. package/module/Validate/object/intersection.js +25 -0
  111. package/module/Validate/object/intersection.js.map +1 -0
  112. package/module/Validate/object/optional.d.ts +6 -0
  113. package/module/Validate/object/optional.js +6 -0
  114. package/module/Validate/object/optional.js.map +1 -1
  115. package/module/Validate/object/union.d.ts +9 -0
  116. package/module/Validate/object/union.js +27 -0
  117. package/module/Validate/object/union.js.map +1 -0
  118. package/module/Validate/parseEmail.js +6 -0
  119. package/module/Validate/parseEmail.js.map +1 -1
  120. package/module/Validate/string/uuid.d.ts +1 -5
  121. package/module/Validate/string/uuid.js +19 -2
  122. package/module/Validate/string/uuid.js.map +1 -1
  123. package/module/es5/Array/arraysJoin.js +20 -2
  124. package/module/es5/Array/sum.js +38 -4
  125. package/module/es5/Array/zip.js +23 -17
  126. package/module/es5/Array/zipLongest.js +27 -14
  127. package/module/es5/Crypto/decodeBase58.js +1 -2
  128. package/module/es5/Crypto/encodeBase32.js +12 -6
  129. package/module/es5/DataStructure/priorityQueue.js +8 -3
  130. package/module/es5/IP/ipToBinaryString.js +2 -2
  131. package/module/es5/IP/longToIp.d.ts +1 -1
  132. package/module/es5/IP/longToIp.js +2 -13
  133. package/module/es5/Math/addition.js +4 -13
  134. package/module/es5/Math/multiplication.js +37 -6
  135. package/module/es5/Math/nCr.js +7 -2
  136. package/module/es5/Math/standardDeviation.js +25 -10
  137. package/module/es5/Math/subtract.js +12 -9
  138. package/module/es5/Object/deepClone.d.ts +10 -0
  139. package/module/es5/Object/deepClone.js +16 -9
  140. package/module/es5/Object/getObjectsCommon.d.ts +10 -0
  141. package/module/es5/Object/getObjectsCommon.js +10 -0
  142. package/module/es5/Object/getObjectsDiff.d.ts +10 -0
  143. package/module/es5/Object/getObjectsDiff.js +32 -17
  144. package/module/es5/Object/has.d.ts +10 -0
  145. package/module/es5/Object/has.js +11 -7
  146. package/module/es5/Object/index.d.ts +4 -0
  147. package/module/es5/Object/index.js +44 -0
  148. package/module/es5/Object/keyBy.d.ts +10 -0
  149. package/module/es5/Object/keyBy.js +10 -0
  150. package/module/es5/Object/mapKeys.d.ts +10 -0
  151. package/module/es5/Object/mapKeys.js +12 -1
  152. package/module/es5/Object/mapValues.d.ts +10 -0
  153. package/module/es5/Object/mapValues.js +10 -0
  154. package/module/es5/Object/merge.d.ts +10 -0
  155. package/module/es5/Object/merge.js +19 -1
  156. package/module/es5/Object/mergeDeep.d.ts +10 -0
  157. package/module/es5/Object/mergeDeep.js +34 -18
  158. package/module/es5/Object/pick.d.ts +10 -0
  159. package/module/es5/Object/pick.js +10 -0
  160. package/module/es5/Object/pickDeep.d.ts +10 -0
  161. package/module/es5/Object/pickDeep.js +10 -3
  162. package/module/es5/Object/removePrototype.d.ts +15 -0
  163. package/module/es5/Object/removePrototype.js +31 -0
  164. package/module/es5/Object/removePrototypeDeep.d.ts +11 -0
  165. package/module/es5/Object/removePrototypeDeep.js +81 -0
  166. package/module/es5/Object/removePrototypeMap.d.ts +9 -0
  167. package/module/es5/Object/removePrototypeMap.js +20 -0
  168. package/module/es5/Object/removePrototypeMapDeep.d.ts +9 -0
  169. package/module/es5/Object/removePrototypeMapDeep.js +20 -0
  170. package/module/es5/String/escapeHtml.js +12 -3
  171. package/module/es5/String/formatString/applyFormatter.js +5 -5
  172. package/module/es5/String/formatString/getValue.js +4 -1
  173. package/module/es5/String/levenshteinDistance.js +43 -28
  174. package/module/es5/String/slugify.js +8 -1
  175. package/module/es5/String/trimEndCharacters.js +3 -1
  176. package/module/es5/String/trimStartCharacters.js +3 -1
  177. package/module/es5/String/unescapeHtml.d.ts +1 -1
  178. package/module/es5/String/unescapeHtml.js +46 -4
  179. package/module/es5/Tool/parseJson.js +14 -1
  180. package/module/es5/URL/buildUrl.js +4 -0
  181. package/module/es5/URL/parseQueryString.js +4 -0
  182. package/module/es5/Validate/isDeepEqual.js +48 -39
  183. package/module/es5/Validate/isPrimeNumber.js +14 -2
  184. package/module/es5/Validate/object/index.d.ts +2 -0
  185. package/module/es5/Validate/object/index.js +22 -0
  186. package/module/es5/Validate/object/intersection.d.ts +10 -0
  187. package/module/es5/Validate/object/intersection.js +34 -0
  188. package/module/es5/Validate/object/optional.d.ts +6 -0
  189. package/module/es5/Validate/object/optional.js +6 -0
  190. package/module/es5/Validate/object/union.d.ts +9 -0
  191. package/module/es5/Validate/object/union.js +36 -0
  192. package/module/es5/Validate/parseEmail.js +8 -0
  193. package/module/es5/Validate/string/uuid.d.ts +1 -5
  194. package/module/es5/Validate/string/uuid.js +24 -2
  195. package/package.json +19 -19
  196. package/module/es5/tsconfig.tsbuildinfo +0 -1
@@ -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,10 +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
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
84
- continue;
85
- }
86
- result[key] = _cloneValue(value[key]);
83
+ result[key] = _cloneValue(value[key], depth + 1);
87
84
  }
88
85
  return result;
89
86
  };
@@ -101,10 +98,20 @@ var _cloneValue = function cloneValue(value) {
101
98
  * cloned.b.c = 99;
102
99
  * original.b.c; // still 2
103
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)
104
111
  */
105
112
  var deepClone = exports.deepClone = function deepClone(value) {
106
113
  if (value === null || _typeof(value) !== "object") {
107
114
  return value;
108
115
  }
109
- return _cloneValue(value);
116
+ return _cloneValue(value, 0);
110
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 });
@@ -34,6 +34,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
34
34
  * @param {...Record<string, unknown>[]} objects - Additional objects to compare.
35
35
  * @returns {Partial<T>} Object containing only the key-value pairs shared by all inputs.
36
36
  *
37
+ * @remarks
38
+ * **Prototype pollution warning:** This function does not filter out
39
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
40
+ * If processing user-controlled input, sanitize with the appropriate
41
+ * `removePrototype*` helper before calling this function:
42
+ * - `removePrototype` — shallow sanitization of a single object
43
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
44
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
45
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
46
+ *
37
47
  * @example
38
48
  * ```typescript
39
49
  * getObjectsCommon({ a: 1, b: 2 }, { a: 1, c: 3 });
@@ -13,6 +13,16 @@
13
13
  * @param {...Record<string, unknown>[]} objects - Additional objects to compare.
14
14
  * @returns {Partial<T>} Object containing only key-value pairs unique to one input.
15
15
  *
16
+ * @remarks
17
+ * **Prototype pollution warning:** This function does not filter out
18
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
19
+ * If processing user-controlled input, sanitize with the appropriate
20
+ * `removePrototype*` helper before calling this function:
21
+ * - `removePrototype` — shallow sanitization of a single object
22
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
23
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
24
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
25
+ *
16
26
  * @example
17
27
  * ```typescript
18
28
  * getObjectsDiff({ a: 1, b: 2 }, { b: 2, c: 3 });
@@ -37,6 +37,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
37
37
  * @param {...Record<string, unknown>[]} objects - Additional objects to compare.
38
38
  * @returns {Partial<T>} Object containing only key-value pairs unique to one input.
39
39
  *
40
+ * @remarks
41
+ * **Prototype pollution warning:** This function does not filter out
42
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
43
+ * If processing user-controlled input, sanitize with the appropriate
44
+ * `removePrototype*` helper before calling this function:
45
+ * - `removePrototype` — shallow sanitization of a single object
46
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
47
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
48
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
49
+ *
40
50
  * @example
41
51
  * ```typescript
42
52
  * getObjectsDiff({ a: 1, b: 2 }, { b: 2, c: 3 });
@@ -111,27 +121,32 @@ var _getObjectsDiff = exports.getObjectsDiff = function getObjectsDiff(object) {
111
121
  }
112
122
  var lastUniqueValue = void 0;
113
123
  var hasUnique = false;
124
+
125
+ // Count occurrences in a single pass using a Map — O(n) instead of O(n²).
126
+ // Map keys use SameValueZero which matches === for all values except NaN,
127
+ // an acceptable trade-off for object-diff use cases.
128
+ var valueCounts = new Map();
114
129
  for (var _i2 = 0, _values = values; _i2 < _values.length; _i2++) {
130
+ var _valueCounts$get;
115
131
  var value = _values[_i2];
116
- var count = 0;
117
- var _iterator4 = _createForOfIteratorHelper(values),
118
- _step4;
119
- try {
120
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
121
- var other = _step4.value;
122
- if (value === other) {
123
- count++;
124
- }
132
+ valueCounts.set(value, ((_valueCounts$get = valueCounts.get(value)) !== null && _valueCounts$get !== void 0 ? _valueCounts$get : 0) + 1);
133
+ }
134
+ var _iterator4 = _createForOfIteratorHelper(valueCounts),
135
+ _step4;
136
+ try {
137
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
138
+ var _step4$value = _slicedToArray(_step4.value, 2),
139
+ _value = _step4$value[0],
140
+ count = _step4$value[1];
141
+ if (count === 1) {
142
+ lastUniqueValue = _value;
143
+ hasUnique = true;
125
144
  }
126
- } catch (err) {
127
- _iterator4.e(err);
128
- } finally {
129
- _iterator4.f();
130
- }
131
- if (count === 1) {
132
- lastUniqueValue = value;
133
- hasUnique = true;
134
145
  }
146
+ } catch (err) {
147
+ _iterator4.e(err);
148
+ } finally {
149
+ _iterator4.f();
135
150
  }
136
151
  if (hasUnique) {
137
152
  result[_key2] = lastUniqueValue;
@@ -6,6 +6,16 @@
6
6
  * @example has({ a: { b: 1 } }, "a.b"); // true
7
7
  * has({ a: { b: 1 } }, ["a", "b"]); // true
8
8
  * has({ a: { b: 1 } }, "a.c"); // false
9
+ *
10
+ * @remarks
11
+ * **Prototype pollution warning:** This function does not filter out
12
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
13
+ * If processing user-controlled input, sanitize with the appropriate
14
+ * `removePrototype*` helper before calling this function:
15
+ * - `removePrototype` — shallow sanitization of a single object
16
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
17
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
18
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
9
19
  */
10
20
  export declare const has: <T extends {
11
21
  [key: string]: unknown;
@@ -4,15 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.has = 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
7
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
8
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
9
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- 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; }
12
- 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; }
13
- 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; }
14
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
- 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); }
16
10
  /**
17
11
  * Determines if an object has a specified path
18
12
  * @param {T} object - Object to check
@@ -21,10 +15,20 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
21
15
  * @example has({ a: { b: 1 } }, "a.b"); // true
22
16
  * has({ a: { b: 1 } }, ["a", "b"]); // true
23
17
  * has({ a: { b: 1 } }, "a.c"); // false
18
+ *
19
+ * @remarks
20
+ * **Prototype pollution warning:** This function does not filter out
21
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
22
+ * If processing user-controlled input, sanitize with the appropriate
23
+ * `removePrototype*` helper before calling this function:
24
+ * - `removePrototype` — shallow sanitization of a single object
25
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
26
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
27
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
24
28
  */
25
29
  var has = exports.has = function has(object, path) {
26
30
  var localPath = typeof path === "string" ? path.split(".") : path;
27
- var current = _objectSpread({}, object);
31
+ var current = object;
28
32
  var _iterator = _createForOfIteratorHelper(localPath),
29
33
  _step;
30
34
  try {
@@ -12,3 +12,7 @@ export * from "./mergeDeep";
12
12
  export * from "./omit";
13
13
  export * from "./pick";
14
14
  export * from "./pickDeep";
15
+ export * from "./removePrototype";
16
+ export * from "./removePrototypeDeep";
17
+ export * from "./removePrototypeMap";
18
+ export * from "./removePrototypeMapDeep";
@@ -156,4 +156,48 @@ Object.keys(_pickDeep).forEach(function (key) {
156
156
  return _pickDeep[key];
157
157
  }
158
158
  });
159
+ });
160
+ var _removePrototype = require("./removePrototype");
161
+ Object.keys(_removePrototype).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _removePrototype[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function get() {
167
+ return _removePrototype[key];
168
+ }
169
+ });
170
+ });
171
+ var _removePrototypeDeep = require("./removePrototypeDeep");
172
+ Object.keys(_removePrototypeDeep).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (key in exports && exports[key] === _removePrototypeDeep[key]) return;
175
+ Object.defineProperty(exports, key, {
176
+ enumerable: true,
177
+ get: function get() {
178
+ return _removePrototypeDeep[key];
179
+ }
180
+ });
181
+ });
182
+ var _removePrototypeMap = require("./removePrototypeMap");
183
+ Object.keys(_removePrototypeMap).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _removePrototypeMap[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function get() {
189
+ return _removePrototypeMap[key];
190
+ }
191
+ });
192
+ });
193
+ var _removePrototypeMapDeep = require("./removePrototypeMapDeep");
194
+ Object.keys(_removePrototypeMapDeep).forEach(function (key) {
195
+ if (key === "default" || key === "__esModule") return;
196
+ if (key in exports && exports[key] === _removePrototypeMapDeep[key]) return;
197
+ Object.defineProperty(exports, key, {
198
+ enumerable: true,
199
+ get: function get() {
200
+ return _removePrototypeMapDeep[key];
201
+ }
202
+ });
159
203
  });
@@ -5,6 +5,16 @@ type Iteratee<T> = IterateeFunction<T> | keyof T;
5
5
  * Creates an object composed of keys generated from the results of running each element of collection through iteratee
6
6
  * @param collection The collection to iterate over
7
7
  * @param iteratee The iteratee function or property name to generate the key
8
+ *
9
+ * @remarks
10
+ * **Prototype pollution warning:** This function does not filter out
11
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
12
+ * If processing user-controlled input, sanitize with the appropriate
13
+ * `removePrototype*` helper before calling this function:
14
+ * - `removePrototype` — shallow sanitization of a single object
15
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
16
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
17
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
8
18
  */
9
19
  export declare function keyBy<T>(collection: T[] | Record<PropertyName, T>, iteratee?: Iteratee<T>): Record<PropertyName, T>;
10
20
  export {};
@@ -11,6 +11,16 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
11
11
  * Creates an object composed of keys generated from the results of running each element of collection through iteratee
12
12
  * @param collection The collection to iterate over
13
13
  * @param iteratee The iteratee function or property name to generate the key
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
  function keyBy(collection, iteratee) {
16
26
  var getKey = normalizeIteratee(iteratee);
@@ -6,6 +6,16 @@
6
6
  * @param function_ - The function invoked per key. Receives (value, key).
7
7
  * @returns A new object with transformed keys.
8
8
  *
9
+ * @remarks
10
+ * **Prototype pollution warning:** This function does not filter out
11
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
12
+ * If processing user-controlled input, sanitize with the appropriate
13
+ * `removePrototype*` helper before calling this function:
14
+ * - `removePrototype` — shallow sanitization of a single object
15
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
16
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
17
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
18
+ *
9
19
  * @example
10
20
  * ```typescript
11
21
  * mapKeys({ a: 1, b: 2 }, (_value, key) => key.toUpperCase());
@@ -12,6 +12,16 @@ exports.mapKeys = void 0;
12
12
  * @param function_ - The function invoked per key. Receives (value, key).
13
13
  * @returns A new object with transformed keys.
14
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)
24
+ *
15
25
  * @example
16
26
  * ```typescript
17
27
  * mapKeys({ a: 1, b: 2 }, (_value, key) => key.toUpperCase());
@@ -26,7 +36,8 @@ var mapKeys = exports.mapKeys = function mapKeys(object, function_) {
26
36
  while (index < length) {
27
37
  var key = keys[index];
28
38
  var value = object[key];
29
- result[function_(value, key)] = value;
39
+ var newKey = function_(value, key);
40
+ result[newKey] = value;
30
41
  index += 1;
31
42
  }
32
43
  return result;
@@ -6,6 +6,16 @@
6
6
  * @param function_ - The function invoked per value. Receives (value, key).
7
7
  * @returns A new object with transformed values.
8
8
  *
9
+ * @remarks
10
+ * **Prototype pollution warning:** This function does not filter out
11
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
12
+ * If processing user-controlled input, sanitize with the appropriate
13
+ * `removePrototype*` helper before calling this function:
14
+ * - `removePrototype` — shallow sanitization of a single object
15
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
16
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
17
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
18
+ *
9
19
  * @example
10
20
  * ```typescript
11
21
  * mapValues({ a: 1, b: 2 }, (value) => value * 2);
@@ -12,6 +12,16 @@ exports.mapValues = void 0;
12
12
  * @param function_ - The function invoked per value. Receives (value, key).
13
13
  * @returns A new object with transformed values.
14
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)
24
+ *
15
25
  * @example
16
26
  * ```typescript
17
27
  * mapValues({ a: 1, b: 2 }, (value) => value * 2);
@@ -4,5 +4,15 @@ import type { UnionToIntersection } from "../types/logic/unionToIntersection";
4
4
  * @param target - The target object to merge into
5
5
  * @param sources - The source objects to merge from
6
6
  * @returns The merged object
7
+ *
8
+ * @remarks
9
+ * **Prototype pollution warning:** This function does not filter out
10
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
11
+ * If processing user-controlled input, sanitize with the appropriate
12
+ * `removePrototype*` helper before calling this function:
13
+ * - `removePrototype` — shallow sanitization of a single object
14
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
15
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
16
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
7
17
  */
8
18
  export declare const merge: <T extends Record<string, unknown>, U extends Record<string, unknown>[]>(target: T, ...sources: U) => T & UnionToIntersection<U[number]>;