es-toolkit 1.2.0-dev.51 → 1.2.0-dev.53

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 (156) hide show
  1. package/dist/array/differenceWith.d.mts +1 -1
  2. package/dist/array/differenceWith.d.ts +1 -1
  3. package/dist/array/differenceWith.js.map +1 -1
  4. package/dist/array/differenceWith.mjs +1 -1
  5. package/dist/array/drop.d.mts +1 -1
  6. package/dist/array/drop.d.ts +1 -1
  7. package/dist/array/drop.js.map +1 -1
  8. package/dist/array/drop.mjs +1 -1
  9. package/dist/array/dropRight.d.mts +1 -1
  10. package/dist/array/dropRight.d.ts +1 -1
  11. package/dist/array/dropRight.js.map +1 -1
  12. package/dist/array/dropRight.mjs +1 -1
  13. package/dist/array/dropRightWhile.d.mts +1 -1
  14. package/dist/array/dropRightWhile.d.ts +1 -1
  15. package/dist/array/dropRightWhile.js.map +1 -1
  16. package/dist/array/dropRightWhile.mjs +1 -1
  17. package/dist/array/index.js.map +1 -1
  18. package/dist/array/index.mjs +16 -16
  19. package/dist/array/intersectionWith.d.mts +1 -1
  20. package/dist/array/intersectionWith.d.ts +1 -1
  21. package/dist/array/intersectionWith.js.map +1 -1
  22. package/dist/array/intersectionWith.mjs +1 -1
  23. package/dist/array/take.js.map +1 -1
  24. package/dist/array/take.mjs +1 -1
  25. package/dist/array/union.js.map +1 -1
  26. package/dist/array/union.mjs +2 -2
  27. package/dist/array/unionBy.d.mts +1 -1
  28. package/dist/array/unionBy.d.ts +1 -1
  29. package/dist/array/unionBy.js.map +1 -1
  30. package/dist/array/unionBy.mjs +1 -1
  31. package/dist/array/unionWith.js.map +1 -1
  32. package/dist/array/unionWith.mjs +2 -2
  33. package/dist/array/uniq.d.mts +1 -1
  34. package/dist/array/uniq.d.ts +1 -1
  35. package/dist/array/uniq.js.map +1 -1
  36. package/dist/array/uniq.mjs +1 -1
  37. package/dist/array/uniqBy.d.mts +4 -0
  38. package/dist/array/uniqBy.d.ts +4 -0
  39. package/dist/array/uniqBy.js.map +1 -1
  40. package/dist/array/uniqBy.mjs +2 -2
  41. package/dist/array/uniqWith.d.mts +4 -0
  42. package/dist/array/uniqWith.d.ts +4 -0
  43. package/dist/array/uniqWith.js.map +1 -1
  44. package/dist/array/uniqWith.mjs +1 -1
  45. package/dist/array/xor.js.map +1 -1
  46. package/dist/array/xor.mjs +3 -3
  47. package/dist/array/xorBy.d.mts +1 -1
  48. package/dist/array/xorBy.d.ts +1 -1
  49. package/dist/array/xorBy.js.map +1 -1
  50. package/dist/array/xorBy.mjs +2 -2
  51. package/dist/array/xorWith.js.map +1 -1
  52. package/dist/array/xorWith.mjs +5 -5
  53. package/dist/array/zipWith.d.mts +1 -1
  54. package/dist/array/zipWith.d.ts +1 -1
  55. package/dist/array/zipWith.js.map +1 -1
  56. package/dist/array/zipWith.mjs +1 -1
  57. package/dist/{chunk-6BCRFIEW.mjs → chunk-25R2U4KM.mjs} +1 -1
  58. package/dist/{chunk-6BCRFIEW.mjs.map → chunk-25R2U4KM.mjs.map} +1 -1
  59. package/dist/{chunk-VKVA56XG.mjs → chunk-3GMXDQQQ.mjs} +2 -2
  60. package/dist/{chunk-OLBUAFBX.mjs → chunk-4RRRH7OY.mjs} +1 -1
  61. package/dist/{chunk-OLBUAFBX.mjs.map → chunk-4RRRH7OY.mjs.map} +1 -1
  62. package/dist/{chunk-M3SHJ3LL.mjs → chunk-5NSVMWDQ.mjs} +1 -1
  63. package/dist/{chunk-M3SHJ3LL.mjs.map → chunk-5NSVMWDQ.mjs.map} +1 -1
  64. package/dist/{chunk-7LAOIS6P.mjs → chunk-6Z2YFKXQ.mjs} +1 -1
  65. package/dist/{chunk-7LAOIS6P.mjs.map → chunk-6Z2YFKXQ.mjs.map} +1 -1
  66. package/dist/{chunk-B5P232BA.mjs → chunk-7OU22ENP.mjs} +1 -1
  67. package/dist/chunk-7OU22ENP.mjs.map +1 -0
  68. package/dist/{chunk-SQOYF647.mjs → chunk-7ROFZNHY.mjs} +1 -1
  69. package/dist/chunk-7ROFZNHY.mjs.map +1 -0
  70. package/dist/{chunk-Y6ZRNII6.mjs → chunk-AIRSKN47.mjs} +1 -1
  71. package/dist/{chunk-Y6ZRNII6.mjs.map → chunk-AIRSKN47.mjs.map} +1 -1
  72. package/dist/{chunk-PRTIPC5X.mjs → chunk-C4IZ7TGA.mjs} +1 -1
  73. package/dist/chunk-C4IZ7TGA.mjs.map +1 -0
  74. package/dist/{chunk-TCHT4HCP.mjs → chunk-ERPXZYH2.mjs} +4 -4
  75. package/dist/{chunk-6GRNTXI3.mjs → chunk-EXU45QAF.mjs} +1 -1
  76. package/dist/{chunk-6GRNTXI3.mjs.map → chunk-EXU45QAF.mjs.map} +1 -1
  77. package/dist/{chunk-GLAZTR32.mjs → chunk-I2NAKQIE.mjs} +2 -2
  78. package/dist/{chunk-TK2EDHSP.mjs → chunk-K3UNRNNO.mjs} +2 -2
  79. package/dist/chunk-K3UNRNNO.mjs.map +1 -0
  80. package/dist/{chunk-SPLO5OZW.mjs → chunk-LIXL7PEP.mjs} +1 -1
  81. package/dist/chunk-LIXL7PEP.mjs.map +1 -0
  82. package/dist/{chunk-RK6PRCEJ.mjs → chunk-MLCL773E.mjs} +1 -1
  83. package/dist/chunk-MLCL773E.mjs.map +1 -0
  84. package/dist/{chunk-4PNP6CKQ.mjs → chunk-MTT7OPUK.mjs} +2 -2
  85. package/dist/chunk-MTT7OPUK.mjs.map +1 -0
  86. package/dist/{chunk-AFYV2UVZ.mjs → chunk-NQXYPWUH.mjs} +1 -1
  87. package/dist/{chunk-AFYV2UVZ.mjs.map → chunk-NQXYPWUH.mjs.map} +1 -1
  88. package/dist/{chunk-KBJTBR5T.mjs → chunk-OHQAR5AU.mjs} +1 -1
  89. package/dist/{chunk-KBJTBR5T.mjs.map → chunk-OHQAR5AU.mjs.map} +1 -1
  90. package/dist/{chunk-JDMFIUGM.mjs → chunk-SWPLMJR7.mjs} +1 -1
  91. package/dist/chunk-SWPLMJR7.mjs.map +1 -0
  92. package/dist/{chunk-YHY2XTJW.mjs → chunk-V7E5DGZP.mjs} +1 -1
  93. package/dist/chunk-V7E5DGZP.mjs.map +1 -0
  94. package/dist/{chunk-HOQRMBSB.mjs → chunk-VH2PV426.mjs} +1 -1
  95. package/dist/{chunk-HOQRMBSB.mjs.map → chunk-VH2PV426.mjs.map} +1 -1
  96. package/dist/{chunk-6LDIBBWQ.mjs → chunk-VOAKEOIM.mjs} +1 -1
  97. package/dist/chunk-VOAKEOIM.mjs.map +1 -0
  98. package/dist/{chunk-YEZIGQJG.mjs → chunk-XDERWWNA.mjs} +2 -2
  99. package/dist/{chunk-J6SWM4X6.mjs → chunk-ZE42UHNG.mjs} +1 -1
  100. package/dist/chunk-ZE42UHNG.mjs.map +1 -0
  101. package/dist/index.js.map +1 -1
  102. package/dist/index.mjs +24 -24
  103. package/dist/math/clamp.d.mts +1 -1
  104. package/dist/math/clamp.d.ts +1 -1
  105. package/dist/math/clamp.js.map +1 -1
  106. package/dist/math/clamp.mjs +1 -1
  107. package/dist/math/index.js.map +1 -1
  108. package/dist/math/index.mjs +3 -3
  109. package/dist/math/round.d.mts +1 -1
  110. package/dist/math/round.d.ts +1 -1
  111. package/dist/math/round.js.map +1 -1
  112. package/dist/math/round.mjs +1 -1
  113. package/dist/math/sum.d.mts +1 -1
  114. package/dist/math/sum.d.ts +1 -1
  115. package/dist/math/sum.js.map +1 -1
  116. package/dist/math/sum.mjs +1 -1
  117. package/dist/object/index.js.map +1 -1
  118. package/dist/object/index.mjs +2 -2
  119. package/dist/object/omit.d.mts +1 -1
  120. package/dist/object/omit.d.ts +1 -1
  121. package/dist/object/omit.js.map +1 -1
  122. package/dist/object/omit.mjs +1 -1
  123. package/dist/object/pick.d.mts +1 -1
  124. package/dist/object/pick.d.ts +1 -1
  125. package/dist/object/pick.js.map +1 -1
  126. package/dist/object/pick.mjs +1 -1
  127. package/dist/predicate/index.js.map +1 -1
  128. package/dist/predicate/index.mjs +3 -3
  129. package/dist/predicate/isNil.d.mts +1 -1
  130. package/dist/predicate/isNil.d.ts +1 -1
  131. package/dist/predicate/isNil.js.map +1 -1
  132. package/dist/predicate/isNil.mjs +1 -1
  133. package/dist/predicate/isNull.d.mts +1 -1
  134. package/dist/predicate/isNull.d.ts +1 -1
  135. package/dist/predicate/isNull.js.map +1 -1
  136. package/dist/predicate/isNull.mjs +1 -1
  137. package/dist/predicate/isUndefined.d.mts +1 -1
  138. package/dist/predicate/isUndefined.d.ts +1 -1
  139. package/dist/predicate/isUndefined.js.map +1 -1
  140. package/dist/predicate/isUndefined.mjs +1 -1
  141. package/package.json +1 -1
  142. package/dist/chunk-4PNP6CKQ.mjs.map +0 -1
  143. package/dist/chunk-6LDIBBWQ.mjs.map +0 -1
  144. package/dist/chunk-B5P232BA.mjs.map +0 -1
  145. package/dist/chunk-J6SWM4X6.mjs.map +0 -1
  146. package/dist/chunk-JDMFIUGM.mjs.map +0 -1
  147. package/dist/chunk-PRTIPC5X.mjs.map +0 -1
  148. package/dist/chunk-RK6PRCEJ.mjs.map +0 -1
  149. package/dist/chunk-SPLO5OZW.mjs.map +0 -1
  150. package/dist/chunk-SQOYF647.mjs.map +0 -1
  151. package/dist/chunk-TK2EDHSP.mjs.map +0 -1
  152. package/dist/chunk-YHY2XTJW.mjs.map +0 -1
  153. /package/dist/{chunk-VKVA56XG.mjs.map → chunk-3GMXDQQQ.mjs.map} +0 -0
  154. /package/dist/{chunk-TCHT4HCP.mjs.map → chunk-ERPXZYH2.mjs.map} +0 -0
  155. /package/dist/{chunk-GLAZTR32.mjs.map → chunk-I2NAKQIE.mjs.map} +0 -0
  156. /package/dist/{chunk-YEZIGQJG.mjs.map → chunk-XDERWWNA.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unionWith
3
- } from "../chunk-YEZIGQJG.mjs";
4
- import "../chunk-SQOYF647.mjs";
3
+ } from "../chunk-XDERWWNA.mjs";
4
+ import "../chunk-7ROFZNHY.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
7
7
  unionWith
@@ -8,7 +8,7 @@
8
8
  * @returns {T[]} A new array with only unique values from the original array.
9
9
  *
10
10
  * @example
11
- * * const array = [1, 2, 2, 3, 4, 4, 5];
11
+ * const array = [1, 2, 2, 3, 4, 4, 5];
12
12
  * const result = uniq(array);
13
13
  * // result will be [1, 2, 3, 4, 5]
14
14
  */
@@ -8,7 +8,7 @@
8
8
  * @returns {T[]} A new array with only unique values from the original array.
9
9
  *
10
10
  * @example
11
- * * const array = [1, 2, 2, 3, 4, 4, 5];
11
+ * const array = [1, 2, 2, 3, 4, 4, 5];
12
12
  * const result = uniq(array);
13
13
  * // result will be [1, 2, 3, 4, 5]
14
14
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniq.ts"],"sourcesContent":["/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/uniq.ts"],"sourcesContent":["/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniq
3
- } from "../chunk-JDMFIUGM.mjs";
3
+ } from "../chunk-SWPLMJR7.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  uniq
@@ -3,6 +3,10 @@
3
3
  *
4
4
  * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.
5
5
  *
6
+ * @param {T[]} arr - The array to process.
7
+ * @param {(item: T) => U} converter - The function used to convert the array elements.
8
+ * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the converter function.
9
+ *
6
10
  * @example
7
11
  * ```ts
8
12
  * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
@@ -3,6 +3,10 @@
3
3
  *
4
4
  * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.
5
5
  *
6
+ * @param {T[]} arr - The array to process.
7
+ * @param {(item: T) => U} converter - The function used to convert the array elements.
8
+ * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the converter function.
9
+ *
6
10
  * @example
7
11
  * ```ts
8
12
  * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniqBy.ts","../../src/array/uniqWith.ts"],"sourcesContent":["import { uniqWith } from './uniqWith';\n\n/**\n * The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.\n *\n * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: T[], converter: (item: T) => U): T[] {\n return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));\n}\n","/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ADVO,SAAS,OAAa,KAAU,WAAgC;AACrE,SAAO,SAAS,KAAK,CAAC,OAAO,UAAU,UAAU,KAAK,MAAM,UAAU,KAAK,CAAC;AAC9E;","names":[]}
1
+ {"version":3,"sources":["../../src/array/uniqBy.ts","../../src/array/uniqWith.ts"],"sourcesContent":["import { uniqWith } from './uniqWith';\n\n/**\n * The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.\n *\n * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} converter - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the converter function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: T[], converter: (item: T) => U): T[] {\n return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));\n}\n","/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ADVO,SAAS,OAAa,KAAU,WAAgC;AACrE,SAAO,SAAS,KAAK,CAAC,OAAO,UAAU,UAAU,KAAK,MAAM,UAAU,KAAK,CAAC;AAC9E;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uniqBy
3
- } from "../chunk-TK2EDHSP.mjs";
4
- import "../chunk-SQOYF647.mjs";
3
+ } from "../chunk-K3UNRNNO.mjs";
4
+ import "../chunk-7ROFZNHY.mjs";
5
5
  import "../chunk-2MM5EJJX.mjs";
6
6
  export {
7
7
  uniqBy
@@ -3,6 +3,10 @@
3
3
  *
4
4
  * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.
5
5
  *
6
+ * @param {T[]} arr - The array to process.
7
+ * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.
8
+ * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.
9
+ *
6
10
  * @example
7
11
  * ```ts
8
12
  * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
@@ -3,6 +3,10 @@
3
3
  *
4
4
  * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.
5
5
  *
6
+ * @param {T[]} arr - The array to process.
7
+ * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.
8
+ * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.
9
+ *
6
10
  * @example
7
11
  * ```ts
8
12
  * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniqWith.ts"],"sourcesContent":["/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/uniqWith.ts"],"sourcesContent":["/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqWith
3
- } from "../chunk-SQOYF647.mjs";
3
+ } from "../chunk-7ROFZNHY.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  uniqWith
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xor.ts","../../src/array/difference.ts","../../src/array/intersection.ts","../../src/array/uniq.ts","../../src/array/union.ts"],"sourcesContent":["import { difference } from './difference';\nimport { intersection } from './intersection';\nimport { union } from './union';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: T[], arr2: T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n","/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: T[], secondArr: T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => !secondSet.has(item));\n}\n","/**\n * Returns the intersection of two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements that are\n * present in both arrays. It effectively filters out any elements from the first array that\n * are not found in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @returns {T[]} A new array containing the elements that are present in both arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n */\nexport function intersection<T>(firstArr: T[], secondArr: T[]): T[] {\n return firstArr.filter(item => {\n return secondArr.includes(item);\n });\n}\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n","import { uniq } from './uniq';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: T[], arr2: T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,WAAc,UAAe,WAAqB;AAChE,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AACrD;;;ACTO,SAAS,aAAgB,UAAe,WAAqB;AAClE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,SAAS,IAAI;AAAA,EAChC,CAAC;AACH;;;ACPO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;;;ACRO,SAAS,MAAS,MAAW,MAAgB;AAClD,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;AJAO,SAAS,IAAO,MAAW,MAAgB;AAChD,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xor.ts","../../src/array/difference.ts","../../src/array/intersection.ts","../../src/array/uniq.ts","../../src/array/union.ts"],"sourcesContent":["import { difference } from './difference';\nimport { intersection } from './intersection';\nimport { union } from './union';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: T[], arr2: T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n","/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: T[], secondArr: T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => !secondSet.has(item));\n}\n","/**\n * Returns the intersection of two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements that are\n * present in both arrays. It effectively filters out any elements from the first array that\n * are not found in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @returns {T[]} A new array containing the elements that are present in both arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n */\nexport function intersection<T>(firstArr: T[], secondArr: T[]): T[] {\n return firstArr.filter(item => {\n return secondArr.includes(item);\n });\n}\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: T[]): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (result.includes(item)) {\n continue;\n }\n\n result.push(item);\n }\n\n return result;\n}\n","import { uniq } from './uniq';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: T[], arr2: T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,WAAc,UAAe,WAAqB;AAChE,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AACrD;;;ACTO,SAAS,aAAgB,UAAe,WAAqB;AAClE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,SAAS,IAAI;AAAA,EAChC,CAAC;AACH;;;ACPO,SAAS,KAAQ,KAAe;AACrC,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,QAAI,OAAO,SAAS,IAAI,GAAG;AACzB;AAAA,IACF;AAEA,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;;;ACRO,SAAS,MAAS,MAAW,MAAgB;AAClD,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;AJAO,SAAS,IAAO,MAAW,MAAgB;AAChD,SAAO,WAAW,MAAM,MAAM,IAAI,GAAG,aAAa,MAAM,IAAI,CAAC;AAC/D;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  xor
3
- } from "../chunk-VKVA56XG.mjs";
4
- import "../chunk-GLAZTR32.mjs";
5
- import "../chunk-JDMFIUGM.mjs";
3
+ } from "../chunk-3GMXDQQQ.mjs";
4
+ import "../chunk-I2NAKQIE.mjs";
5
+ import "../chunk-SWPLMJR7.mjs";
6
6
  import "../chunk-YNRYG5OB.mjs";
7
7
  import "../chunk-SORNYLIU.mjs";
8
8
  import "../chunk-2MM5EJJX.mjs";
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @param {T[]} arr1 - The first array.
10
10
  * @param {T[]} arr2 - The second array.
11
- * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
11
+ * @param {(item: T) => U} mapper - The function to map array elements to comparison values.
12
12
  * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
13
13
  *
14
14
  * @example
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @param {T[]} arr1 - The first array.
10
10
  * @param {T[]} arr2 - The second array.
11
- * @param {function(item: T): U} mapper - The function to map array elements to comparison values.
11
+ * @param {(item: T) => U} mapper - The function to map array elements to comparison values.
12
12
  * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
13
13
  *
14
14
  * @example
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xorBy.ts","../../src/array/differenceBy.ts","../../src/array/intersectionBy.ts","../../src/array/unionBy.ts"],"sourcesContent":["import { differenceBy } from './differenceBy';\nimport { intersectionBy } from './intersectionBy';\nimport { unionBy } from './unionBy';\n\n/**\n * Computes the symmetric difference between two arrays using a custom mapping function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection, determined by the result of the mapping function.\n *\n * @template T - Type of elements in the input arrays.\n * @template U - Type of the values returned by the mapping function.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {function(item: T): U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = obj => obj.id;\n * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const union = unionBy(arr1, arr2, mapper);\n const intersection = intersectionBy(arr1, arr2, mapper);\n\n return differenceBy(union, intersection, mapper);\n}\n","/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n *\n * This function takes two arrays and a mapper function. It returns a new array containing the elements\n * that are present in the first array but not in the second array, based on the identity calculated\n * by the mapper function.\n *\n * Essentially, it filters out any elements from the first array that, when\n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function\n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding\n * mapped identity in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));\n\n return firstArr.filter(item => {\n return !mappedSecondSet.has(mapper(item));\n });\n}\n","/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: T[], secondArr: T[], mapper: (item: T) => U): T[] {\n const mappedSecondArr = secondArr.map(x => mapper(x));\n\n return firstArr.filter(item => {\n return mappedSecondArr.includes(mapper(item));\n });\n}\n","/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {function(item: T): U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return [...map.values()];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyBO,SAAS,aAAmB,UAAe,WAAgB,QAA8B;AAC9F,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC,CAAC;AAEnE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,IAAI,OAAO,IAAI,CAAC;AAAA,EAC1C,CAAC;AACH;;;ACXO,SAAS,eAAqB,UAAe,WAAgB,QAA6B;AAC/F,QAAM,kBAAkB,UAAU,IAAI,OAAK,OAAO,CAAC,CAAC;AAEpD,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC9C,CAAC;AACH;;;ACNO,SAAS,QAAc,MAAW,MAAW,QAA6B;AAC/E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AACvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;;;AHRO,SAAS,MAAY,MAAW,MAAW,QAA6B;AAC7E,QAAM,QAAQ,QAAQ,MAAM,MAAM,MAAM;AACxC,QAAM,eAAe,eAAe,MAAM,MAAM,MAAM;AAEtD,SAAO,aAAa,OAAO,cAAc,MAAM;AACjD;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xorBy.ts","../../src/array/differenceBy.ts","../../src/array/intersectionBy.ts","../../src/array/unionBy.ts"],"sourcesContent":["import { differenceBy } from './differenceBy';\nimport { intersectionBy } from './intersectionBy';\nimport { unionBy } from './unionBy';\n\n/**\n * Computes the symmetric difference between two arrays using a custom mapping function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection, determined by the result of the mapping function.\n *\n * @template T - Type of elements in the input arrays.\n * @template U - Type of the values returned by the mapping function.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item: T) => U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = obj => obj.id;\n * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const union = unionBy(arr1, arr2, mapper);\n const intersection = intersectionBy(arr1, arr2, mapper);\n\n return differenceBy(union, intersection, mapper);\n}\n","/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n *\n * This function takes two arrays and a mapper function. It returns a new array containing the elements\n * that are present in the first array but not in the second array, based on the identity calculated\n * by the mapper function.\n *\n * Essentially, it filters out any elements from the first array that, when\n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function\n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding\n * mapped identity in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: T[], secondArr: T[], mapper: (value: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));\n\n return firstArr.filter(item => {\n return !mappedSecondSet.has(mapper(item));\n });\n}\n","/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: T[], secondArr: T[], mapper: (item: T) => U): T[] {\n const mappedSecondArr = secondArr.map(x => mapper(x));\n\n return firstArr.filter(item => {\n return mappedSecondArr.includes(mapper(item));\n });\n}\n","/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item: T) => U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return [...map.values()];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyBO,SAAS,aAAmB,UAAe,WAAgB,QAA8B;AAC9F,QAAM,kBAAkB,IAAI,IAAI,UAAU,IAAI,UAAQ,OAAO,IAAI,CAAC,CAAC;AAEnE,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,CAAC,gBAAgB,IAAI,OAAO,IAAI,CAAC;AAAA,EAC1C,CAAC;AACH;;;ACXO,SAAS,eAAqB,UAAe,WAAgB,QAA6B;AAC/F,QAAM,kBAAkB,UAAU,IAAI,OAAK,OAAO,CAAC,CAAC;AAEpD,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAAA,EAC9C,CAAC;AACH;;;ACNO,SAAS,QAAc,MAAW,MAAW,QAA6B;AAC/E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AACvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;;;AHRO,SAAS,MAAY,MAAW,MAAW,QAA6B;AAC7E,QAAM,QAAQ,QAAQ,MAAM,MAAM,MAAM;AACxC,QAAM,eAAe,eAAe,MAAM,MAAM,MAAM;AAEtD,SAAO,aAAa,OAAO,cAAc,MAAM;AACjD;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  xorBy
3
- } from "../chunk-4PNP6CKQ.mjs";
4
- import "../chunk-SPLO5OZW.mjs";
3
+ } from "../chunk-MTT7OPUK.mjs";
4
+ import "../chunk-LIXL7PEP.mjs";
5
5
  import "../chunk-ANJSX6WH.mjs";
6
6
  import "../chunk-HK5OJANS.mjs";
7
7
  import "../chunk-2MM5EJJX.mjs";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/xorWith.ts","../../src/array/differenceWith.ts","../../src/array/intersectionWith.ts","../../src/array/uniqWith.ts","../../src/array/unionWith.ts"],"sourcesContent":["import { differenceWith } from './differenceWith';\nimport { intersectionWith } from './intersectionWith';\nimport { unionWith } from './unionWith';\n\n/**\n * Computes the symmetric difference between two arrays using a custom equality function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection.\n *\n * @template T - Type of elements in the input arrays.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.\n *\n * @example\n * // Custom equality function for objects with an 'id' property\n * const areObjectsEqual = (a, b) => a.id === b.id;\n * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorWith<T>(arr1: T[], arr2: T[], areElementsEqual: (item1: T, item2: T) => boolean): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n\n return differenceWith(union, intersection, areElementsEqual);\n}\n","/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n","import { uniqWith } from './uniqWith';\n\n/**\n * Creates an array of unique values from two given arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function, merges the arrays, and returns\n * a new array containing only the unique values as determined by the custom equality function.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array of unique values based on the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }];\n * const array2 = [{ id: 2 }, { id: 3 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = unionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays\n */\nexport function unionWith<T>(arr1: T[], arr2: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;;;ACNO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;;;AChBO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ACFO,SAAS,UAAa,MAAW,MAAW,eAAqD;AACtG,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;;;AJDO,SAAS,QAAW,MAAW,MAAW,kBAAwD;AACvG,QAAM,QAAQ,UAAU,MAAM,MAAM,gBAAgB;AACpD,QAAM,eAAe,iBAAiB,MAAM,MAAM,gBAAgB;AAElE,SAAO,eAAe,OAAO,cAAc,gBAAgB;AAC7D;","names":[]}
1
+ {"version":3,"sources":["../../src/array/xorWith.ts","../../src/array/differenceWith.ts","../../src/array/intersectionWith.ts","../../src/array/uniqWith.ts","../../src/array/unionWith.ts"],"sourcesContent":["import { differenceWith } from './differenceWith';\nimport { intersectionWith } from './intersectionWith';\nimport { unionWith } from './unionWith';\n\n/**\n * Computes the symmetric difference between two arrays using a custom equality function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection.\n *\n * @template T - Type of elements in the input arrays.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.\n *\n * @example\n * // Custom equality function for objects with an 'id' property\n * const areObjectsEqual = (a, b) => a.id === b.id;\n * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorWith<T>(arr1: T[], arr2: T[], areElementsEqual: (item1: T, item2: T) => boolean): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n\n return differenceWith(union, intersection, areElementsEqual);\n}\n","/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n","import { uniqWith } from './uniqWith';\n\n/**\n * Creates an array of unique values from two given arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function, merges the arrays, and returns\n * a new array containing only the unique values as determined by the custom equality function.\n *\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array of unique values based on the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }];\n * const array2 = [{ id: 2 }, { id: 3 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = unionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays\n */\nexport function unionWith<T>(arr1: T[], arr2: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;;;ACNO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;;;ACZO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;;;ACNO,SAAS,UAAa,MAAW,MAAW,eAAqD;AACtG,SAAO,SAAS,KAAK,OAAO,IAAI,GAAG,aAAa;AAClD;;;AJDO,SAAS,QAAW,MAAW,MAAW,kBAAwD;AACvG,QAAM,QAAQ,UAAU,MAAM,MAAM,gBAAgB;AACpD,QAAM,eAAe,iBAAiB,MAAM,MAAM,gBAAgB;AAElE,SAAO,eAAe,OAAO,cAAc,gBAAgB;AAC7D;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  xorWith
3
- } from "../chunk-TCHT4HCP.mjs";
4
- import "../chunk-YEZIGQJG.mjs";
5
- import "../chunk-SQOYF647.mjs";
6
- import "../chunk-7LAOIS6P.mjs";
7
- import "../chunk-M3SHJ3LL.mjs";
3
+ } from "../chunk-ERPXZYH2.mjs";
4
+ import "../chunk-XDERWWNA.mjs";
5
+ import "../chunk-7ROFZNHY.mjs";
6
+ import "../chunk-6Z2YFKXQ.mjs";
7
+ import "../chunk-5NSVMWDQ.mjs";
8
8
  import "../chunk-2MM5EJJX.mjs";
9
9
  export {
10
10
  xorWith
@@ -8,7 +8,7 @@
8
8
  * @param {U[]} [arr2] - The second array to zip (optional).
9
9
  * @param {V[]} [arr3] - The third array to zip (optional).
10
10
  * @param {W[]} [arr4] - The fourth array to zip (optional).
11
- * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
11
+ * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
12
12
  * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
13
13
  *
14
14
  * @example
@@ -8,7 +8,7 @@
8
8
  * @param {U[]} [arr2] - The second array to zip (optional).
9
9
  * @param {V[]} [arr3] - The third array to zip (optional).
10
10
  * @param {W[]} [arr4] - The fourth array to zip (optional).
11
- * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
11
+ * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.
12
12
  * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
13
13
  *
14
14
  * @example
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: T[], arr2: U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(arr1: T[], arr2: U[], arr3: V[], combine: (item1: T, item2: U, item3: V) => R): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: T[],\n arr2: U[],\n arr3: V[],\n arr4: W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCO,SAAS,QAAc,SAAc,MAAkB;AAC5D,QAAM,OAAO,CAAC,MAAM,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC;AACxC,QAAM,UAAU,KAAK,KAAK,SAAS,CAAC;AAEpC,QAAM,SAAc,CAAC;AACrB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,SAAO,IAAI,MAAM,CAAC;AAExD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,WAAgB,KAAK,IAAI,SAAO,IAAI,CAAC,CAAC;AAC5C,WAAO,KAAK,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: T[], arr2: U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(arr1: T[], arr2: U[], arr3: V[], combine: (item1: T, item2: U, item3: V) => R): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: T[],\n arr2: U[],\n arr3: V[],\n arr4: W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCO,SAAS,QAAc,SAAc,MAAkB;AAC5D,QAAM,OAAO,CAAC,MAAM,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC;AACxC,QAAM,UAAU,KAAK,KAAK,SAAS,CAAC;AAEpC,QAAM,SAAc,CAAC;AACrB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,SAAO,IAAI,MAAM,CAAC;AAExD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,WAAgB,KAAK,IAAI,SAAO,IAAI,CAAC,CAAC;AAC5C,WAAO,KAAK,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  zipWith
3
- } from "../chunk-PRTIPC5X.mjs";
3
+ } from "../chunk-C4IZ7TGA.mjs";
4
4
  import "../chunk-2MM5EJJX.mjs";
5
5
  export {
6
6
  zipWith
@@ -6,4 +6,4 @@ function drop(arr, itemsCount) {
6
6
  export {
7
7
  drop
8
8
  };
9
- //# sourceMappingURL=chunk-6BCRFIEW.mjs.map
9
+ //# sourceMappingURL=chunk-25R2U4KM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAeO,SAAS,KAAQ,KAAU,YAAyB;AACzD,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAeO,SAAS,KAAQ,KAAU,YAAyB;AACzD,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  union
3
- } from "./chunk-GLAZTR32.mjs";
3
+ } from "./chunk-I2NAKQIE.mjs";
4
4
  import {
5
5
  intersection
6
6
  } from "./chunk-YNRYG5OB.mjs";
@@ -16,4 +16,4 @@ function xor(arr1, arr2) {
16
16
  export {
17
17
  xor
18
18
  };
19
- //# sourceMappingURL=chunk-VKVA56XG.mjs.map
19
+ //# sourceMappingURL=chunk-3GMXDQQQ.mjs.map
@@ -6,4 +6,4 @@ function take(arr, count) {
6
6
  export {
7
7
  take
8
8
  };
9
- //# sourceMappingURL=chunk-OLBUAFBX.mjs.map
9
+ //# sourceMappingURL=chunk-4RRRH7OY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/take.ts"],"sourcesContent":["/**\n * Returns a new array containing the first `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the first `count` elements from `arr`.\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3, 4, 5], 3);\n *\n * @example\n * // Returns ['a', 'b']\n * take(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3], 5);\n */\nexport function take<T>(arr: T[], count: number) {\n return arr.slice(0, count);\n}\n"],"mappings":";AAsBO,SAAS,KAAQ,KAAU,OAAe;AAC/C,SAAO,IAAI,MAAM,GAAG,KAAK;AAC3B;","names":[]}
1
+ {"version":3,"sources":["../src/array/take.ts"],"sourcesContent":["/**\n * Returns a new array containing the first `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the first `count` elements from `arr`.\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3, 4, 5], 3);\n *\n * @example\n * // Returns ['a', 'b']\n * take(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3], 5);\n */\nexport function take<T>(arr: T[], count: number): T[] {\n return arr.slice(0, count);\n}\n"],"mappings":";AAsBO,SAAS,KAAQ,KAAU,OAAoB;AACpD,SAAO,IAAI,MAAM,GAAG,KAAK;AAC3B;","names":[]}
@@ -10,4 +10,4 @@ function differenceWith(firstArr, secondArr, areItemsEqual) {
10
10
  export {
11
11
  differenceWith
12
12
  };
13
- //# sourceMappingURL=chunk-M3SHJ3LL.mjs.map
13
+ //# sourceMappingURL=chunk-5NSVMWDQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/differenceWith.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/array/differenceWith.ts"],"sourcesContent":["/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,eAAkB,UAAe,WAAgB,eAA6C;AAC5G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,MAAM,gBAAc;AACnC,aAAO,CAAC,cAAc,WAAW,UAAU;AAAA,IAC7C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -10,4 +10,4 @@ function intersectionWith(firstArr, secondArr, areItemsEqual) {
10
10
  export {
11
11
  intersectionWith
12
12
  };
13
- //# sourceMappingURL=chunk-7LAOIS6P.mjs.map
13
+ //# sourceMappingURL=chunk-6Z2YFKXQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/array/intersectionWith.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(firstArr: T[], secondArr: T[], areItemsEqual: (x: T, y: T) => boolean): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n"],"mappings":";AAqBO,SAAS,iBAAoB,UAAe,WAAgB,eAA6C;AAC9G,SAAO,SAAS,OAAO,eAAa;AAClC,WAAO,UAAU,KAAK,gBAAc;AAClC,aAAO,cAAc,WAAW,UAAU;AAAA,IAC5C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -10,4 +10,4 @@ function sum(nums) {
10
10
  export {
11
11
  sum
12
12
  };
13
- //# sourceMappingURL=chunk-B5P232BA.mjs.map
13
+ //# sourceMappingURL=chunk-7OU22ENP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: number[]): number {\n let result = 0;\n\n for (const num of nums) {\n result += num;\n }\n\n return result;\n}\n"],"mappings":";AAaO,SAAS,IAAI,MAAwB;AAC1C,MAAI,SAAS;AAEb,aAAW,OAAO,MAAM;AACtB,cAAU;AAAA,EACZ;AAEA,SAAO;AACT;","names":[]}
@@ -13,4 +13,4 @@ function uniqWith(arr, areItemsEqual) {
13
13
  export {
14
14
  uniqWith
15
15
  };
16
- //# sourceMappingURL=chunk-SQOYF647.mjs.map
16
+ //# sourceMappingURL=chunk-7ROFZNHY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniqWith.ts"],"sourcesContent":["/**\n * The `uniqWith` function takes an array as its first argument and a 'comparator' function as the second.\n *\n * It evaluates the elements of the array using the comparator function, and if true is returned, it considers those elements as duplicates and removes them.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1, 2, 3, 5, 7]\n * ```\n */\nexport function uniqWith<T>(arr: T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n"],"mappings":";AAeO,SAAS,SAAY,KAAU,eAAqD;AACzF,QAAM,SAAc,CAAC;AAErB,aAAW,QAAQ,KAAK;AACtB,UAAM,SAAS,OAAO,MAAM,OAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAExD,QAAI,QAAQ;AACV,aAAO,KAAK,IAAI;AAAA,IAClB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -6,4 +6,4 @@ function isNull(x) {
6
6
  export {
7
7
  isNull
8
8
  };
9
- //# sourceMappingURL=chunk-Y6ZRNII6.mjs.map
9
+ //# sourceMappingURL=chunk-AIRSKN47.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/predicate/isNull.ts"],"sourcesContent":["/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n"],"mappings":";AAoBO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;","names":[]}
1
+ {"version":3,"sources":["../src/predicate/isNull.ts"],"sourcesContent":["/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n"],"mappings":";AAoBO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;","names":[]}
@@ -14,4 +14,4 @@ function zipWith(arr1, ...rest) {
14
14
  export {
15
15
  zipWith
16
16
  };
17
- //# sourceMappingURL=chunk-PRTIPC5X.mjs.map
17
+ //# sourceMappingURL=chunk-C4IZ7TGA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/zipWith.ts"],"sourcesContent":["/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: T[], arr2: U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(arr1: T[], arr2: U[], arr3: V[], combine: (item1: T, item2: U, item3: V) => R): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: T[],\n arr2: U[],\n arr3: V[],\n arr4: W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n"],"mappings":";AAsCO,SAAS,QAAc,SAAc,MAAkB;AAC5D,QAAM,OAAO,CAAC,MAAM,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC;AACxC,QAAM,UAAU,KAAK,KAAK,SAAS,CAAC;AAEpC,QAAM,SAAc,CAAC;AACrB,QAAM,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,SAAO,IAAI,MAAM,CAAC;AAExD,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,WAAgB,KAAK,IAAI,SAAO,IAAI,CAAC,CAAC;AAC5C,WAAO,KAAK,QAAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  unionWith
3
- } from "./chunk-YEZIGQJG.mjs";
3
+ } from "./chunk-XDERWWNA.mjs";
4
4
  import {
5
5
  intersectionWith
6
- } from "./chunk-7LAOIS6P.mjs";
6
+ } from "./chunk-6Z2YFKXQ.mjs";
7
7
  import {
8
8
  differenceWith
9
- } from "./chunk-M3SHJ3LL.mjs";
9
+ } from "./chunk-5NSVMWDQ.mjs";
10
10
 
11
11
  // src/array/xorWith.ts
12
12
  function xorWith(arr1, arr2, areElementsEqual) {
@@ -18,4 +18,4 @@ function xorWith(arr1, arr2, areElementsEqual) {
18
18
  export {
19
19
  xorWith
20
20
  };
21
- //# sourceMappingURL=chunk-TCHT4HCP.mjs.map
21
+ //# sourceMappingURL=chunk-ERPXZYH2.mjs.map
@@ -6,4 +6,4 @@ function dropRight(arr, itemsCount) {
6
6
  export {
7
7
  dropRight
8
8
  };
9
- //# sourceMappingURL=chunk-6GRNTXI3.mjs.map
9
+ //# sourceMappingURL=chunk-EXU45QAF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";AAeO,SAAS,UAAa,KAAU,YAAyB;AAC9D,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
1
+ {"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";AAeO,SAAS,UAAa,KAAU,YAAyB;AAC9D,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniq
3
- } from "./chunk-JDMFIUGM.mjs";
3
+ } from "./chunk-SWPLMJR7.mjs";
4
4
 
5
5
  // src/array/union.ts
6
6
  function union(arr1, arr2) {
@@ -10,4 +10,4 @@ function union(arr1, arr2) {
10
10
  export {
11
11
  union
12
12
  };
13
- //# sourceMappingURL=chunk-GLAZTR32.mjs.map
13
+ //# sourceMappingURL=chunk-I2NAKQIE.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uniqWith
3
- } from "./chunk-SQOYF647.mjs";
3
+ } from "./chunk-7ROFZNHY.mjs";
4
4
 
5
5
  // src/array/uniqBy.ts
6
6
  function uniqBy(arr, converter) {
@@ -10,4 +10,4 @@ function uniqBy(arr, converter) {
10
10
  export {
11
11
  uniqBy
12
12
  };
13
- //# sourceMappingURL=chunk-TK2EDHSP.mjs.map
13
+ //# sourceMappingURL=chunk-K3UNRNNO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/uniqBy.ts"],"sourcesContent":["import { uniqWith } from './uniqWith';\n\n/**\n * The `uniqBy` function takes an array as its first argument and a 'converter' function as the second. It maps the array elements using the converter function, then removes any duplicates.\n *\n * It filters out elements with the same value, meaning it does not check for duplicates in data types like Objects.\n *\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} converter - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the converter function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: T[], converter: (item: T) => U): T[] {\n return uniqWith(arr, (item1, item2) => converter(item1) === converter(item2));\n}\n"],"mappings":";;;;;AAiBO,SAAS,OAAa,KAAU,WAAgC;AACrE,SAAO,SAAS,KAAK,CAAC,OAAO,UAAU,UAAU,KAAK,MAAM,UAAU,KAAK,CAAC;AAC9E;","names":[]}
@@ -13,4 +13,4 @@ function unionBy(arr1, arr2, mapper) {
13
13
  export {
14
14
  unionBy
15
15
  };
16
- //# sourceMappingURL=chunk-SPLO5OZW.mjs.map
16
+ //# sourceMappingURL=chunk-LIXL7PEP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unionBy.ts"],"sourcesContent":["/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item: T) => U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: T[], arr2: T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return [...map.values()];\n}\n"],"mappings":";AAoBO,SAAS,QAAc,MAAW,MAAW,QAA6B;AAC/E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG;AACrC,UAAM,MAAM,OAAO,IAAI;AACvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;","names":[]}
@@ -9,4 +9,4 @@ function clamp(value, bound1, bound2) {
9
9
  export {
10
10
  clamp
11
11
  };
12
- //# sourceMappingURL=chunk-RK6PRCEJ.mjs.map
12
+ //# sourceMappingURL=chunk-MLCL773E.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/math/clamp.ts"],"sourcesContent":["/**\n * Clamps a number within the inclusive lower and upper bounds.\n *\n * This function takes a number and two bounds, and returns the number clamped within the specified bounds.\n * If only one bound is provided, it returns the minimum of the value and the bound.\n *\n * @param {number} value - The number to clamp.\n * @param {number} minimum - The minimum bound to clamp the number.\n * @param {number} maximum - The maximum bound to clamp the number.\n * @returns {number} The clamped number within the specified bounds.\n *\n * @example\n * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5\n * const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15\n * const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5\n * const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15\n */\nexport function clamp(value: number, maximum: number): number;\nexport function clamp(value: number, minimum: number, maximum: number): number;\nexport function clamp(value: number, bound1: number, bound2?: number): number {\n if (bound2 == null) {\n return Math.min(value, bound1);\n }\n\n return Math.min(Math.max(value, bound1), bound2);\n}\n"],"mappings":";AAmBO,SAAS,MAAM,OAAe,QAAgB,QAAyB;AAC5E,MAAI,UAAU,MAAM;AAClB,WAAO,KAAK,IAAI,OAAO,MAAM;AAAA,EAC/B;AAEA,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,MAAM,GAAG,MAAM;AACjD;","names":[]}