es-toolkit 1.6.1-dev.142 → 1.6.1-dev.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/forEachRight.d.mts +25 -0
- package/dist/array/forEachRight.d.ts +25 -0
- package/dist/array/forEachRight.js +36 -0
- package/dist/array/forEachRight.js.map +1 -0
- package/dist/array/forEachRight.mjs +8 -0
- package/dist/array/index.d.mts +5 -3
- package/dist/array/index.d.ts +5 -3
- package/dist/array/index.js +47 -21
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +43 -35
- package/dist/array/unzipWith.d.mts +17 -0
- package/dist/array/unzipWith.d.ts +17 -0
- package/dist/array/unzipWith.js +42 -0
- package/dist/array/unzipWith.js.map +1 -0
- package/dist/array/unzipWith.mjs +8 -0
- package/dist/array/unzipWith.mjs.map +1 -0
- package/dist/chunk-IEA53J7P.mjs +12 -0
- package/dist/chunk-IEA53J7P.mjs.map +1 -0
- package/dist/chunk-IFNXROZR.mjs +18 -0
- package/dist/chunk-IFNXROZR.mjs.map +1 -0
- package/dist/chunk-XJR5WV2Z.mjs +1 -0
- package/dist/chunk-XJR5WV2Z.mjs.map +1 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +47 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -62
- package/dist/predicate/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-56TFSD6O.mjs +0 -1
- /package/dist/{chunk-56TFSD6O.mjs.map → array/forEachRight.mjs.map} +0 -0
package/dist/array/index.mjs
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-XJR5WV2Z.mjs";
|
|
2
|
+
import {
|
|
3
|
+
zip
|
|
4
|
+
} from "../chunk-IDCUZVJL.mjs";
|
|
5
|
+
import {
|
|
6
|
+
zipObject
|
|
7
|
+
} from "../chunk-6GWEY5EL.mjs";
|
|
8
|
+
import {
|
|
9
|
+
zipWith
|
|
10
|
+
} from "../chunk-4KYXHZ4R.mjs";
|
|
11
|
+
import {
|
|
12
|
+
uniqBy
|
|
13
|
+
} from "../chunk-OXAZEEGP.mjs";
|
|
14
|
+
import {
|
|
15
|
+
unzipWith
|
|
16
|
+
} from "../chunk-IFNXROZR.mjs";
|
|
2
17
|
import {
|
|
3
18
|
without
|
|
4
19
|
} from "../chunk-PYEYV7BY.mjs";
|
|
@@ -12,14 +27,11 @@ import {
|
|
|
12
27
|
xorWith
|
|
13
28
|
} from "../chunk-QRSJBBFY.mjs";
|
|
14
29
|
import {
|
|
15
|
-
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import {
|
|
18
|
-
zipObject
|
|
19
|
-
} from "../chunk-6GWEY5EL.mjs";
|
|
30
|
+
shuffle
|
|
31
|
+
} from "../chunk-G7UQ5PUR.mjs";
|
|
20
32
|
import {
|
|
21
|
-
|
|
22
|
-
} from "../chunk-
|
|
33
|
+
take
|
|
34
|
+
} from "../chunk-ME352XO7.mjs";
|
|
23
35
|
import {
|
|
24
36
|
takeRight
|
|
25
37
|
} from "../chunk-IQLKIDXF.mjs";
|
|
@@ -32,6 +44,9 @@ import {
|
|
|
32
44
|
import {
|
|
33
45
|
union
|
|
34
46
|
} from "../chunk-R6QA7PLZ.mjs";
|
|
47
|
+
import {
|
|
48
|
+
uniq
|
|
49
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
35
50
|
import {
|
|
36
51
|
unionBy
|
|
37
52
|
} from "../chunk-NFS7RWWE.mjs";
|
|
@@ -42,11 +57,11 @@ import {
|
|
|
42
57
|
uniqWith
|
|
43
58
|
} from "../chunk-237HGSZS.mjs";
|
|
44
59
|
import {
|
|
45
|
-
|
|
46
|
-
} from "../chunk-
|
|
60
|
+
intersectionBy
|
|
61
|
+
} from "../chunk-O6UXZR3U.mjs";
|
|
47
62
|
import {
|
|
48
|
-
|
|
49
|
-
} from "../chunk-
|
|
63
|
+
intersectionWith
|
|
64
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
50
65
|
import {
|
|
51
66
|
keyBy
|
|
52
67
|
} from "../chunk-AJKZMN2V.mjs";
|
|
@@ -65,21 +80,9 @@ import {
|
|
|
65
80
|
import {
|
|
66
81
|
sampleSize
|
|
67
82
|
} from "../chunk-LUIKU43M.mjs";
|
|
68
|
-
import "../chunk-TZE6EDCX.mjs";
|
|
69
|
-
import "../chunk-MLCL773E.mjs";
|
|
70
|
-
import "../chunk-CXGIXTSH.mjs";
|
|
71
|
-
import "../chunk-LT6E4Y4Z.mjs";
|
|
72
|
-
import "../chunk-NOFHNJ5C.mjs";
|
|
73
|
-
import "../chunk-GIWAOOFY.mjs";
|
|
74
|
-
import "../chunk-SYWMYQYJ.mjs";
|
|
75
|
-
import "../chunk-UNLX2F2Y.mjs";
|
|
76
|
-
import "../chunk-5PMKOZ2F.mjs";
|
|
77
83
|
import {
|
|
78
|
-
|
|
79
|
-
} from "../chunk-
|
|
80
|
-
import {
|
|
81
|
-
take
|
|
82
|
-
} from "../chunk-ME352XO7.mjs";
|
|
84
|
+
dropRight
|
|
85
|
+
} from "../chunk-JEKUA56R.mjs";
|
|
83
86
|
import {
|
|
84
87
|
dropRightWhile
|
|
85
88
|
} from "../chunk-JE6JKZU3.mjs";
|
|
@@ -89,18 +92,15 @@ import {
|
|
|
89
92
|
import {
|
|
90
93
|
fill
|
|
91
94
|
} from "../chunk-C4WE4GLC.mjs";
|
|
95
|
+
import {
|
|
96
|
+
forEachRight
|
|
97
|
+
} from "../chunk-IEA53J7P.mjs";
|
|
92
98
|
import {
|
|
93
99
|
groupBy
|
|
94
100
|
} from "../chunk-E6E4RZLN.mjs";
|
|
95
101
|
import {
|
|
96
102
|
intersection
|
|
97
103
|
} from "../chunk-FVVSE2F2.mjs";
|
|
98
|
-
import {
|
|
99
|
-
intersectionBy
|
|
100
|
-
} from "../chunk-O6UXZR3U.mjs";
|
|
101
|
-
import {
|
|
102
|
-
intersectionWith
|
|
103
|
-
} from "../chunk-XI7KRD2C.mjs";
|
|
104
104
|
import {
|
|
105
105
|
chunk
|
|
106
106
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -122,9 +122,15 @@ import {
|
|
|
122
122
|
import {
|
|
123
123
|
drop
|
|
124
124
|
} from "../chunk-S3CORED5.mjs";
|
|
125
|
-
import
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
import "../chunk-TZE6EDCX.mjs";
|
|
126
|
+
import "../chunk-MLCL773E.mjs";
|
|
127
|
+
import "../chunk-CXGIXTSH.mjs";
|
|
128
|
+
import "../chunk-LT6E4Y4Z.mjs";
|
|
129
|
+
import "../chunk-NOFHNJ5C.mjs";
|
|
130
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
131
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
132
|
+
import "../chunk-UNLX2F2Y.mjs";
|
|
133
|
+
import "../chunk-5PMKOZ2F.mjs";
|
|
128
134
|
import "../chunk-2MM5EJJX.mjs";
|
|
129
135
|
export {
|
|
130
136
|
chunk,
|
|
@@ -138,6 +144,7 @@ export {
|
|
|
138
144
|
dropRightWhile,
|
|
139
145
|
dropWhile,
|
|
140
146
|
fill,
|
|
147
|
+
forEachRight,
|
|
141
148
|
groupBy,
|
|
142
149
|
intersection,
|
|
143
150
|
intersectionBy,
|
|
@@ -159,6 +166,7 @@ export {
|
|
|
159
166
|
uniq,
|
|
160
167
|
uniqBy,
|
|
161
168
|
uniqWith,
|
|
169
|
+
unzipWith,
|
|
162
170
|
without,
|
|
163
171
|
xor,
|
|
164
172
|
xorBy,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
3
|
+
*
|
|
4
|
+
* @template T, R
|
|
5
|
+
* @param {T[][]} target - The nested array to unzip. This is an array of arrays,
|
|
6
|
+
* where each inner array contains elements to be unzipped.
|
|
7
|
+
* @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
|
|
8
|
+
* @returns {R[]} A new array of unzipped and transformed elements.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
12
|
+
* const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);
|
|
13
|
+
* // result will be [9, 12]
|
|
14
|
+
*/
|
|
15
|
+
declare function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[];
|
|
16
|
+
|
|
17
|
+
export { unzipWith };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
3
|
+
*
|
|
4
|
+
* @template T, R
|
|
5
|
+
* @param {T[][]} target - The nested array to unzip. This is an array of arrays,
|
|
6
|
+
* where each inner array contains elements to be unzipped.
|
|
7
|
+
* @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
|
|
8
|
+
* @returns {R[]} A new array of unzipped and transformed elements.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
12
|
+
* const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);
|
|
13
|
+
* // result will be [9, 12]
|
|
14
|
+
*/
|
|
15
|
+
declare function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[];
|
|
16
|
+
|
|
17
|
+
export { unzipWith };
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/array/forEachRight.ts
|
|
2
|
+
function forEachRight(arr, callback) {
|
|
3
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
4
|
+
const element = arr[i];
|
|
5
|
+
callback(element, i, arr);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
forEachRight
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=chunk-IEA53J7P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/forEachRight.ts"],"sourcesContent":["/**\n * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.\n * \n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to iterate over.\n * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration.\n * The callback function receives three arguments:\n * - 'value': The current element being processed in the array.\n * - 'index': The index of the current element being processed in the array.\n * - 'arr': The array 'forEachRight' was called upon.\n * \n * @example\n * const array = [1, 2, 3];\n * const result: number[] = [];\n * \n * // Use the forEachRight function to iterate through the array and add each element to the result array.\n * forEachRight(array, (value) => {\n * result.push(value);\n * })\n * \n * console.log(result) // Output: [3, 2, 1]\n */\n\nexport function forEachRight<T>(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void {\n for (let i = arr.length - 1; i >= 0; i--) {\n const element = arr[i];\n callback(element, i, arr);\n }\n}\n"],"mappings":";AAuBO,SAAS,aAAgB,KAAU,UAA6D;AACrG,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,UAAM,UAAU,IAAI,CAAC;AACrB,aAAS,SAAS,GAAG,GAAG;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -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-XJR5WV2Z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,8 @@ 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';
|
|
12
|
+
export { forEachRight } from './array/forEachRight.mjs';
|
|
11
13
|
export { groupBy } from './array/groupBy.mjs';
|
|
12
14
|
export { intersection } from './array/intersection.mjs';
|
|
13
15
|
export { intersectionBy } from './array/intersectionBy.mjs';
|
|
@@ -29,14 +31,14 @@ export { unionWith } from './array/unionWith.mjs';
|
|
|
29
31
|
export { uniq } from './array/uniq.mjs';
|
|
30
32
|
export { uniqBy } from './array/uniqBy.mjs';
|
|
31
33
|
export { uniqWith } from './array/uniqWith.mjs';
|
|
32
|
-
export {
|
|
34
|
+
export { unzipWith } from './array/unzipWith.mjs';
|
|
33
35
|
export { xor } from './array/xor.mjs';
|
|
34
36
|
export { xorBy } from './array/xorBy.mjs';
|
|
35
37
|
export { xorWith } from './array/xorWith.mjs';
|
|
36
38
|
export { zip } from './array/zip.mjs';
|
|
37
|
-
export { zipWith } from './array/zipWith.mjs';
|
|
38
39
|
export { zipObject } from './array/zipObject.mjs';
|
|
39
|
-
export {
|
|
40
|
+
export { zipWith } from './array/zipWith.mjs';
|
|
41
|
+
export { without } from './array/without.mjs';
|
|
40
42
|
export { AbortError } from './error/AbortError.mjs';
|
|
41
43
|
export { debounce } from './function/debounce.mjs';
|
|
42
44
|
export { noop } from './function/noop.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ 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';
|
|
12
|
+
export { forEachRight } from './array/forEachRight.js';
|
|
11
13
|
export { groupBy } from './array/groupBy.js';
|
|
12
14
|
export { intersection } from './array/intersection.js';
|
|
13
15
|
export { intersectionBy } from './array/intersectionBy.js';
|
|
@@ -29,14 +31,14 @@ export { unionWith } from './array/unionWith.js';
|
|
|
29
31
|
export { uniq } from './array/uniq.js';
|
|
30
32
|
export { uniqBy } from './array/uniqBy.js';
|
|
31
33
|
export { uniqWith } from './array/uniqWith.js';
|
|
32
|
-
export {
|
|
34
|
+
export { unzipWith } from './array/unzipWith.js';
|
|
33
35
|
export { xor } from './array/xor.js';
|
|
34
36
|
export { xorBy } from './array/xorBy.js';
|
|
35
37
|
export { xorWith } from './array/xorWith.js';
|
|
36
38
|
export { zip } from './array/zip.js';
|
|
37
|
-
export { zipWith } from './array/zipWith.js';
|
|
38
39
|
export { zipObject } from './array/zipObject.js';
|
|
39
|
-
export {
|
|
40
|
+
export { zipWith } from './array/zipWith.js';
|
|
41
|
+
export { without } from './array/without.js';
|
|
40
42
|
export { AbortError } from './error/AbortError.js';
|
|
41
43
|
export { debounce } from './function/debounce.js';
|
|
42
44
|
export { noop } from './function/noop.js';
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
dropRightWhile: () => dropRightWhile,
|
|
50
50
|
dropWhile: () => dropWhile,
|
|
51
51
|
fill: () => fill,
|
|
52
|
+
forEachRight: () => forEachRight,
|
|
52
53
|
groupBy: () => groupBy,
|
|
53
54
|
intersection: () => intersection,
|
|
54
55
|
intersectionBy: () => intersectionBy,
|
|
@@ -88,6 +89,7 @@ __export(src_exports, {
|
|
|
88
89
|
uniq: () => uniq,
|
|
89
90
|
uniqBy: () => uniqBy,
|
|
90
91
|
uniqWith: () => uniqWith,
|
|
92
|
+
unzipWith: () => unzipWith,
|
|
91
93
|
without: () => without,
|
|
92
94
|
xor: () => xor,
|
|
93
95
|
xorBy: () => xorBy,
|
|
@@ -184,6 +186,24 @@ function dropRightWhile(arr, canContinueDropping) {
|
|
|
184
186
|
return dropped.slice().reverse();
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
// src/array/fill.ts
|
|
190
|
+
function fill(arr, value, start = 0, end = arr.length) {
|
|
191
|
+
start = Math.max(start, 0);
|
|
192
|
+
end = Math.min(end, arr.length);
|
|
193
|
+
for (let i = start; i < end; i++) {
|
|
194
|
+
arr[i] = value;
|
|
195
|
+
}
|
|
196
|
+
return arr;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/array/forEachRight.ts
|
|
200
|
+
function forEachRight(arr, callback) {
|
|
201
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
202
|
+
const element = arr[i];
|
|
203
|
+
callback(element, i, arr);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
187
207
|
// src/array/groupBy.ts
|
|
188
208
|
function groupBy(arr, getKeyFromItem) {
|
|
189
209
|
const result = {};
|
|
@@ -466,10 +486,18 @@ function uniqBy(arr, mapper) {
|
|
|
466
486
|
return Array.from(map.values());
|
|
467
487
|
}
|
|
468
488
|
|
|
469
|
-
// src/array/
|
|
470
|
-
function
|
|
471
|
-
const
|
|
472
|
-
|
|
489
|
+
// src/array/unzipWith.ts
|
|
490
|
+
function unzipWith(target, iteratee) {
|
|
491
|
+
const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
|
|
492
|
+
const result = new Array(maxLength);
|
|
493
|
+
for (let i = 0; i < maxLength; i++) {
|
|
494
|
+
const group = new Array(target.length);
|
|
495
|
+
for (let j = 0; j < target.length; j++) {
|
|
496
|
+
group[j] = target[j][i];
|
|
497
|
+
}
|
|
498
|
+
result[i] = iteratee(...group);
|
|
499
|
+
}
|
|
500
|
+
return result;
|
|
473
501
|
}
|
|
474
502
|
|
|
475
503
|
// src/array/xor.ts
|
|
@@ -505,6 +533,15 @@ function zip(...arrs) {
|
|
|
505
533
|
return result;
|
|
506
534
|
}
|
|
507
535
|
|
|
536
|
+
// src/array/zipObject.ts
|
|
537
|
+
function zipObject(keys, values) {
|
|
538
|
+
const result = {};
|
|
539
|
+
for (let i = 0; i < keys.length; i++) {
|
|
540
|
+
result[keys[i]] = values[i];
|
|
541
|
+
}
|
|
542
|
+
return result;
|
|
543
|
+
}
|
|
544
|
+
|
|
508
545
|
// src/array/zipWith.ts
|
|
509
546
|
function zipWith(arr1, ...rest) {
|
|
510
547
|
const arrs = [arr1, ...rest.slice(0, -1)];
|
|
@@ -518,23 +555,10 @@ function zipWith(arr1, ...rest) {
|
|
|
518
555
|
return result;
|
|
519
556
|
}
|
|
520
557
|
|
|
521
|
-
// src/array/
|
|
522
|
-
function
|
|
523
|
-
const
|
|
524
|
-
|
|
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;
|
|
558
|
+
// src/array/without.ts
|
|
559
|
+
function without(array, ...values) {
|
|
560
|
+
const valuesSet = new Set(values);
|
|
561
|
+
return array.filter((item) => !valuesSet.has(item));
|
|
538
562
|
}
|
|
539
563
|
|
|
540
564
|
// src/error/AbortError.ts
|
|
@@ -701,6 +725,7 @@ function delay(ms, { signal } = {}) {
|
|
|
701
725
|
dropRightWhile,
|
|
702
726
|
dropWhile,
|
|
703
727
|
fill,
|
|
728
|
+
forEachRight,
|
|
704
729
|
groupBy,
|
|
705
730
|
intersection,
|
|
706
731
|
intersectionBy,
|
|
@@ -740,6 +765,7 @@ function delay(ms, { signal } = {}) {
|
|
|
740
765
|
uniq,
|
|
741
766
|
uniqBy,
|
|
742
767
|
uniqWith,
|
|
768
|
+
unzipWith,
|
|
743
769
|
without,
|
|
744
770
|
xor,
|
|
745
771
|
xorBy,
|