es-toolkit 1.6.1-dev.142 → 1.6.1-dev.143

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.
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/unzipWith.ts
21
+ var unzipWith_exports = {};
22
+ __export(unzipWith_exports, {
23
+ unzipWith: () => unzipWith
24
+ });
25
+ module.exports = __toCommonJS(unzipWith_exports);
26
+ function unzipWith(target, iteratee) {
27
+ const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
28
+ const result = new Array(maxLength);
29
+ for (let i = 0; i < maxLength; i++) {
30
+ const group = new Array(target.length);
31
+ for (let j = 0; j < target.length; j++) {
32
+ group[j] = target[j][i];
33
+ }
34
+ result[i] = iteratee(...group);
35
+ }
36
+ return result;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ unzipWith
41
+ });
42
+ //# sourceMappingURL=unzipWith.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/unzipWith.ts"],"sourcesContent":["/**\n * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.\n *\n * @template T, R\n * @param {T[][]} target - The nested array to unzip. This is an array of arrays,\n * where each inner array contains elements to be unzipped.\n * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.\n * @returns {R[]} A new array of unzipped and transformed elements. \n *\n * @example\n * const nestedArray = [[1, 2], [3, 4], [5, 6]];\n * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);\n * // result will be [9, 12]\n */\nexport function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[] {\n const maxLength = Math.max(...target.map(innerArray => innerArray.length));\n const result: R[] = new Array(maxLength);\n\n for (let i = 0; i < maxLength; i++) {\n const group = new Array(target.length);\n\n for (let j = 0; j < target.length; j++) {\n group[j] = target[j][i];\n }\n\n result[i] = iteratee(...group);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,UAAgB,QAAwB,UAAoC;AAC1F,QAAM,YAAY,KAAK,IAAI,GAAG,OAAO,IAAI,gBAAc,WAAW,MAAM,CAAC;AACzE,QAAM,SAAc,IAAI,MAAM,SAAS;AAEvC,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,QAAQ,IAAI,MAAM,OAAO,MAAM;AAErC,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,YAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;AAAA,IACxB;AAEA,WAAO,CAAC,IAAI,SAAS,GAAG,KAAK;AAAA,EAC/B;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ unzipWith
3
+ } from "../chunk-IFNXROZR.mjs";
4
+ import "../chunk-2MM5EJJX.mjs";
5
+ export {
6
+ unzipWith
7
+ };
8
+ //# sourceMappingURL=unzipWith.mjs.map
@@ -0,0 +1,18 @@
1
+ // src/array/unzipWith.ts
2
+ function unzipWith(target, iteratee) {
3
+ const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
4
+ const result = new Array(maxLength);
5
+ for (let i = 0; i < maxLength; i++) {
6
+ const group = new Array(target.length);
7
+ for (let j = 0; j < target.length; j++) {
8
+ group[j] = target[j][i];
9
+ }
10
+ result[i] = iteratee(...group);
11
+ }
12
+ return result;
13
+ }
14
+
15
+ export {
16
+ unzipWith
17
+ };
18
+ //# sourceMappingURL=chunk-IFNXROZR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/unzipWith.ts"],"sourcesContent":["/**\n * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.\n *\n * @template T, R\n * @param {T[][]} target - The nested array to unzip. This is an array of arrays,\n * where each inner array contains elements to be unzipped.\n * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.\n * @returns {R[]} A new array of unzipped and transformed elements. \n *\n * @example\n * const nestedArray = [[1, 2], [3, 4], [5, 6]];\n * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);\n * // result will be [9, 12]\n */\nexport function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[] {\n const maxLength = Math.max(...target.map(innerArray => innerArray.length));\n const result: R[] = new Array(maxLength);\n\n for (let i = 0; i < maxLength; i++) {\n const group = new Array(target.length);\n\n for (let j = 0; j < target.length; j++) {\n group[j] = target[j][i];\n }\n\n result[i] = iteratee(...group);\n }\n\n return result;\n}\n"],"mappings":";AAcO,SAAS,UAAgB,QAAwB,UAAoC;AAC1F,QAAM,YAAY,KAAK,IAAI,GAAG,OAAO,IAAI,gBAAc,WAAW,MAAM,CAAC;AACzE,QAAM,SAAc,IAAI,MAAM,SAAS;AAEvC,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,QAAQ,IAAI,MAAM,OAAO,MAAM;AAErC,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,YAAM,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;AAAA,IACxB;AAEA,WAAO,CAAC,IAAI,SAAS,GAAG,KAAK;AAAA,EAC/B;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-MBF7KQBM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,16 +1,16 @@
1
1
  import "../chunk-N6EM6ETS.mjs";
2
- import {
3
- debounce
4
- } from "../chunk-3IP4JVLL.mjs";
5
- import {
6
- noop
7
- } from "../chunk-LKXCOLNY.mjs";
8
2
  import {
9
3
  once
10
4
  } from "../chunk-CMBC4MXG.mjs";
11
5
  import {
12
6
  throttle
13
7
  } from "../chunk-QOJGMVVR.mjs";
8
+ import {
9
+ debounce
10
+ } from "../chunk-3IP4JVLL.mjs";
11
+ import {
12
+ noop
13
+ } from "../chunk-LKXCOLNY.mjs";
14
14
  import "../chunk-2MM5EJJX.mjs";
15
15
  export {
16
16
  debounce,
package/dist/index.d.mts CHANGED
@@ -8,6 +8,7 @@ export { drop } from './array/drop.mjs';
8
8
  export { dropRight } from './array/dropRight.mjs';
9
9
  export { dropRightWhile } from './array/dropRightWhile.mjs';
10
10
  export { dropWhile } from './array/dropWhile.mjs';
11
+ export { fill } from './array/fill.mjs';
11
12
  export { groupBy } from './array/groupBy.mjs';
12
13
  export { intersection } from './array/intersection.mjs';
13
14
  export { intersectionBy } from './array/intersectionBy.mjs';
@@ -29,14 +30,14 @@ export { unionWith } from './array/unionWith.mjs';
29
30
  export { uniq } from './array/uniq.mjs';
30
31
  export { uniqBy } from './array/uniqBy.mjs';
31
32
  export { uniqWith } from './array/uniqWith.mjs';
32
- export { without } from './array/without.mjs';
33
+ export { unzipWith } from './array/unzipWith.mjs';
33
34
  export { xor } from './array/xor.mjs';
34
35
  export { xorBy } from './array/xorBy.mjs';
35
36
  export { xorWith } from './array/xorWith.mjs';
36
37
  export { zip } from './array/zip.mjs';
37
- export { zipWith } from './array/zipWith.mjs';
38
38
  export { zipObject } from './array/zipObject.mjs';
39
- export { fill } from './array/fill.mjs';
39
+ export { zipWith } from './array/zipWith.mjs';
40
+ export { without } from './array/without.mjs';
40
41
  export { AbortError } from './error/AbortError.mjs';
41
42
  export { debounce } from './function/debounce.mjs';
42
43
  export { noop } from './function/noop.mjs';
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { drop } from './array/drop.js';
8
8
  export { dropRight } from './array/dropRight.js';
9
9
  export { dropRightWhile } from './array/dropRightWhile.js';
10
10
  export { dropWhile } from './array/dropWhile.js';
11
+ export { fill } from './array/fill.js';
11
12
  export { groupBy } from './array/groupBy.js';
12
13
  export { intersection } from './array/intersection.js';
13
14
  export { intersectionBy } from './array/intersectionBy.js';
@@ -29,14 +30,14 @@ export { unionWith } from './array/unionWith.js';
29
30
  export { uniq } from './array/uniq.js';
30
31
  export { uniqBy } from './array/uniqBy.js';
31
32
  export { uniqWith } from './array/uniqWith.js';
32
- export { without } from './array/without.js';
33
+ export { unzipWith } from './array/unzipWith.js';
33
34
  export { xor } from './array/xor.js';
34
35
  export { xorBy } from './array/xorBy.js';
35
36
  export { xorWith } from './array/xorWith.js';
36
37
  export { zip } from './array/zip.js';
37
- export { zipWith } from './array/zipWith.js';
38
38
  export { zipObject } from './array/zipObject.js';
39
- export { fill } from './array/fill.js';
39
+ export { zipWith } from './array/zipWith.js';
40
+ export { without } from './array/without.js';
40
41
  export { AbortError } from './error/AbortError.js';
41
42
  export { debounce } from './function/debounce.js';
42
43
  export { noop } from './function/noop.js';
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ __export(src_exports, {
88
88
  uniq: () => uniq,
89
89
  uniqBy: () => uniqBy,
90
90
  uniqWith: () => uniqWith,
91
+ unzipWith: () => unzipWith,
91
92
  without: () => without,
92
93
  xor: () => xor,
93
94
  xorBy: () => xorBy,
@@ -184,6 +185,16 @@ function dropRightWhile(arr, canContinueDropping) {
184
185
  return dropped.slice().reverse();
185
186
  }
186
187
 
188
+ // src/array/fill.ts
189
+ function fill(arr, value, start = 0, end = arr.length) {
190
+ start = Math.max(start, 0);
191
+ end = Math.min(end, arr.length);
192
+ for (let i = start; i < end; i++) {
193
+ arr[i] = value;
194
+ }
195
+ return arr;
196
+ }
197
+
187
198
  // src/array/groupBy.ts
188
199
  function groupBy(arr, getKeyFromItem) {
189
200
  const result = {};
@@ -466,10 +477,18 @@ function uniqBy(arr, mapper) {
466
477
  return Array.from(map.values());
467
478
  }
468
479
 
469
- // src/array/without.ts
470
- function without(array, ...values) {
471
- const valuesSet = new Set(values);
472
- return array.filter((item) => !valuesSet.has(item));
480
+ // src/array/unzipWith.ts
481
+ function unzipWith(target, iteratee) {
482
+ const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
483
+ const result = new Array(maxLength);
484
+ for (let i = 0; i < maxLength; i++) {
485
+ const group = new Array(target.length);
486
+ for (let j = 0; j < target.length; j++) {
487
+ group[j] = target[j][i];
488
+ }
489
+ result[i] = iteratee(...group);
490
+ }
491
+ return result;
473
492
  }
474
493
 
475
494
  // src/array/xor.ts
@@ -505,6 +524,15 @@ function zip(...arrs) {
505
524
  return result;
506
525
  }
507
526
 
527
+ // src/array/zipObject.ts
528
+ function zipObject(keys, values) {
529
+ const result = {};
530
+ for (let i = 0; i < keys.length; i++) {
531
+ result[keys[i]] = values[i];
532
+ }
533
+ return result;
534
+ }
535
+
508
536
  // src/array/zipWith.ts
509
537
  function zipWith(arr1, ...rest) {
510
538
  const arrs = [arr1, ...rest.slice(0, -1)];
@@ -518,23 +546,10 @@ function zipWith(arr1, ...rest) {
518
546
  return result;
519
547
  }
520
548
 
521
- // src/array/zipObject.ts
522
- function zipObject(keys, values) {
523
- const result = {};
524
- for (let i = 0; i < keys.length; i++) {
525
- result[keys[i]] = values[i];
526
- }
527
- return result;
528
- }
529
-
530
- // src/array/fill.ts
531
- function fill(arr, value, start = 0, end = arr.length) {
532
- start = Math.max(start, 0);
533
- end = Math.min(end, arr.length);
534
- for (let i = start; i < end; i++) {
535
- arr[i] = value;
536
- }
537
- return arr;
549
+ // src/array/without.ts
550
+ function without(array, ...values) {
551
+ const valuesSet = new Set(values);
552
+ return array.filter((item) => !valuesSet.has(item));
538
553
  }
539
554
 
540
555
  // src/error/AbortError.ts
@@ -740,6 +755,7 @@ function delay(ms, { signal } = {}) {
740
755
  uniq,
741
756
  uniqBy,
742
757
  uniqWith,
758
+ unzipWith,
743
759
  without,
744
760
  xor,
745
761
  xorBy,