es-toolkit 1.29.0-dev.918 → 1.29.0-dev.921
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/_chunk/{zipWith-Bb2eZI.js → zipWith-DLxOmJ.js} +11 -0
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +2 -1
- package/dist/array/index.mjs +1 -0
- package/dist/array/pull.d.mts +19 -0
- package/dist/array/pull.d.ts +19 -0
- package/dist/array/pull.mjs +11 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/pull.d.mts +19 -0
- package/dist/compat/array/pull.d.ts +19 -0
- package/dist/compat/array/pull.mjs +8 -0
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +6 -1
- package/dist/compat/index.mjs +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes all specified values from an array.
|
|
3
|
+
*
|
|
4
|
+
* This function changes `arr` in place.
|
|
5
|
+
* If you want to remove values without modifying the original array, use `difference`.
|
|
6
|
+
*
|
|
7
|
+
* @template T, U
|
|
8
|
+
* @param {T[]} arr - The array to modify.
|
|
9
|
+
* @param {...unknown[]} valuesToRemove - The values to remove from the array.
|
|
10
|
+
* @returns {T[]} The modified array with the specified values removed.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
|
14
|
+
* pull(numbers, [2, 4]);
|
|
15
|
+
* console.log(numbers); // [1, 3, 5]
|
|
16
|
+
*/
|
|
17
|
+
declare function pull<T>(arr: T[], ...valuesToRemove: readonly unknown[][]): T[];
|
|
18
|
+
|
|
19
|
+
export { pull };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes all specified values from an array.
|
|
3
|
+
*
|
|
4
|
+
* This function changes `arr` in place.
|
|
5
|
+
* If you want to remove values without modifying the original array, use `difference`.
|
|
6
|
+
*
|
|
7
|
+
* @template T, U
|
|
8
|
+
* @param {T[]} arr - The array to modify.
|
|
9
|
+
* @param {...unknown[]} valuesToRemove - The values to remove from the array.
|
|
10
|
+
* @returns {T[]} The modified array with the specified values removed.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
|
14
|
+
* pull(numbers, [2, 4]);
|
|
15
|
+
* console.log(numbers); // [1, 3, 5]
|
|
16
|
+
*/
|
|
17
|
+
declare function pull<T>(arr: T[], ...valuesToRemove: readonly unknown[][]): T[];
|
|
18
|
+
|
|
19
|
+
export { pull };
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -106,6 +106,7 @@ export { join } from './array/join.mjs';
|
|
|
106
106
|
export { last } from './array/last.mjs';
|
|
107
107
|
export { lastIndexOf } from './array/lastIndexOf.mjs';
|
|
108
108
|
export { orderBy } from './array/orderBy.mjs';
|
|
109
|
+
export { pull } from './array/pull.mjs';
|
|
109
110
|
export { sample } from './array/sample.mjs';
|
|
110
111
|
export { size } from './array/size.mjs';
|
|
111
112
|
export { slice } from './array/slice.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export { join } from './array/join.js';
|
|
|
106
106
|
export { last } from './array/last.js';
|
|
107
107
|
export { lastIndexOf } from './array/lastIndexOf.js';
|
|
108
108
|
export { orderBy } from './array/orderBy.js';
|
|
109
|
+
export { pull } from './array/pull.js';
|
|
109
110
|
export { sample } from './array/sample.js';
|
|
110
111
|
export { size } from './array/size.js';
|
|
111
112
|
export { slice } from './array/slice.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zipWith = require('../_chunk/zipWith-
|
|
5
|
+
const zipWith = require('../_chunk/zipWith-DLxOmJ.js');
|
|
6
6
|
const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
7
7
|
const unary = require('../_chunk/unary-CcTNuC.js');
|
|
8
8
|
const noop = require('../_chunk/noop-2IwLUk.js');
|
|
@@ -1129,6 +1129,10 @@ function orderBy(collection, criteria, orders, guard) {
|
|
|
1129
1129
|
.map(item => item.original);
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
+
function pull(arr, ...valuesToRemove) {
|
|
1133
|
+
return zipWith.pull(arr, flatten(valuesToRemove));
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1132
1136
|
function sample(collection) {
|
|
1133
1137
|
if (collection == null) {
|
|
1134
1138
|
return undefined;
|
|
@@ -2904,6 +2908,7 @@ exports.padStart = padStart;
|
|
|
2904
2908
|
exports.parseInt = parseInt;
|
|
2905
2909
|
exports.pick = pick;
|
|
2906
2910
|
exports.property = property;
|
|
2911
|
+
exports.pull = pull;
|
|
2907
2912
|
exports.random = random;
|
|
2908
2913
|
exports.rearg = rearg;
|
|
2909
2914
|
exports.repeat = repeat;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -107,6 +107,7 @@ export { join } from './array/join.mjs';
|
|
|
107
107
|
export { last } from './array/last.mjs';
|
|
108
108
|
export { lastIndexOf } from './array/lastIndexOf.mjs';
|
|
109
109
|
export { orderBy } from './array/orderBy.mjs';
|
|
110
|
+
export { pull } from './array/pull.mjs';
|
|
110
111
|
export { sample } from './array/sample.mjs';
|
|
111
112
|
export { size } from './array/size.mjs';
|
|
112
113
|
export { slice } from './array/slice.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.mjs';
|
|
|
29
29
|
export { minBy } from './array/minBy.mjs';
|
|
30
30
|
export { orderBy } from './array/orderBy.mjs';
|
|
31
31
|
export { partition } from './array/partition.mjs';
|
|
32
|
+
export { pull } from './array/pull.mjs';
|
|
32
33
|
export { pullAt } from './array/pullAt.mjs';
|
|
33
34
|
export { sample } from './array/sample.mjs';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.js';
|
|
|
29
29
|
export { minBy } from './array/minBy.js';
|
|
30
30
|
export { orderBy } from './array/orderBy.js';
|
|
31
31
|
export { partition } from './array/partition.js';
|
|
32
|
+
export { pull } from './array/pull.js';
|
|
32
33
|
export { pullAt } from './array/pullAt.js';
|
|
33
34
|
export { sample } from './array/sample.js';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const zipWith = require('./_chunk/zipWith-
|
|
5
|
+
const zipWith = require('./_chunk/zipWith-DLxOmJ.js');
|
|
6
6
|
const array_index = require('./array/index.js');
|
|
7
7
|
const promise_index = require('./_chunk/index-BGZDR9.js');
|
|
8
8
|
const unary = require('./_chunk/unary-CcTNuC.js');
|
|
@@ -52,6 +52,7 @@ exports.last = zipWith.last;
|
|
|
52
52
|
exports.maxBy = zipWith.maxBy;
|
|
53
53
|
exports.minBy = zipWith.minBy;
|
|
54
54
|
exports.partition = zipWith.partition;
|
|
55
|
+
exports.pull = zipWith.pull;
|
|
55
56
|
exports.pullAt = zipWith.pullAt;
|
|
56
57
|
exports.sample = zipWith.sample;
|
|
57
58
|
exports.sampleSize = zipWith.sampleSize;
|
package/dist/index.mjs
CHANGED
|
@@ -29,6 +29,7 @@ export { maxBy } from './array/maxBy.mjs';
|
|
|
29
29
|
export { minBy } from './array/minBy.mjs';
|
|
30
30
|
export { orderBy } from './array/orderBy.mjs';
|
|
31
31
|
export { partition } from './array/partition.mjs';
|
|
32
|
+
export { pull } from './array/pull.mjs';
|
|
32
33
|
export { pullAt } from './array/pullAt.mjs';
|
|
33
34
|
export { sample } from './array/sample.mjs';
|
|
34
35
|
export { sampleSize } from './array/sampleSize.mjs';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.29.0-dev.
|
|
4
|
+
"version": "1.29.0-dev.921+976d5095",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|