es-toolkit 0.0.1 → 1.0.0-dev.24
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/CHANGELOG.md +5 -0
- package/README.md +31 -0
- package/dist/array/chunk.d.ts +21 -5
- package/dist/array/difference.d.ts +20 -4
- package/dist/array/differenceBy.d.ts +23 -5
- package/dist/array/differenceWith.d.ts +19 -5
- package/dist/array/drop.d.ts +13 -4
- package/dist/array/dropRight.d.ts +13 -4
- package/dist/array/dropRightWhile.d.ts +15 -4
- package/dist/array/dropWhile.d.ts +15 -4
- package/dist/array/groupBy.d.ts +31 -1
- package/dist/array/groupBy.spec.d.ts +1 -0
- package/dist/array/index.js +437 -224
- package/dist/array/intersection.d.ts +13 -6
- package/dist/array/intersectionBy.d.ts +17 -8
- package/dist/array/intersectionWith.d.ts +18 -8
- package/dist/array/partition.d.ts +19 -5
- package/dist/array/sample.d.ts +10 -3
- package/dist/array/shuffle.d.ts +11 -4
- package/dist/array/takeRight.d.ts +0 -2
- package/dist/array/union.d.ts +13 -6
- package/dist/array/unionBy.d.ts +0 -3
- package/dist/array/unionWith.d.ts +15 -9
- package/dist/array/uniq.d.ts +9 -8
- package/dist/array/xor.d.ts +0 -2
- package/dist/array/zip.d.ts +18 -6
- package/dist/array/zipWith.d.ts +26 -3
- package/dist/function/debounce.d.ts +4 -4
- package/dist/function/index.js +4 -5
- package/dist/function/once.d.ts +0 -1
- package/dist/index.js +651 -248
- package/dist/math/clamp.d.ts +16 -8
- package/dist/math/index.js +114 -29
- package/dist/math/round.d.ts +11 -8
- package/dist/math/sum.d.ts +10 -9
- package/dist/object/index.js +122 -12
- package/dist/object/omit.d.ts +13 -4
- package/dist/object/omitBy.d.ts +19 -1
- package/dist/object/omitBy.spec.d.ts +1 -0
- package/dist/object/pick.d.ts +13 -4
- package/dist/object/pickBy.d.ts +19 -1
- package/dist/object/pickBy.spec.d.ts +1 -0
- package/dist/predicate/index.js +58 -10
- package/dist/predicate/isNil.d.ts +17 -3
- package/dist/predicate/isNotNil.d.ts +7 -3
- package/dist/predicate/isNull.d.ts +17 -2
- package/dist/predicate/isUndefined.d.ts +17 -2
- package/dist/promise/delay.d.ts +17 -4
- package/dist/promise/index.js +16 -3
- package/esm/array/_virtual/_rollupPluginBabelHelpers.mjs +1 -37
- package/esm/array/chunk.mjs +28 -25
- package/esm/array/difference.mjs +20 -4
- package/esm/array/differenceBy.mjs +23 -5
- package/esm/array/differenceWith.mjs +19 -5
- package/esm/array/drop.mjs +13 -4
- package/esm/array/dropRight.mjs +13 -4
- package/esm/array/dropRightWhile.mjs +15 -4
- package/esm/array/dropWhile.mjs +15 -4
- package/esm/array/groupBy.mjs +51 -2
- package/esm/array/intersection.mjs +13 -6
- package/esm/array/intersectionBy.mjs +17 -8
- package/esm/array/intersectionWith.mjs +18 -8
- package/esm/array/partition.mjs +19 -5
- package/esm/array/sample.mjs +10 -3
- package/esm/array/shuffle.mjs +12 -5
- package/esm/array/takeRight.mjs +0 -2
- package/esm/array/union.mjs +14 -10
- package/esm/array/unionBy.mjs +0 -3
- package/esm/array/unionWith.mjs +16 -11
- package/esm/array/uniq.mjs +28 -9
- package/esm/array/xor.mjs +0 -2
- package/esm/array/zip.mjs +18 -6
- package/esm/array/zipWith.mjs +26 -3
- package/esm/function/debounce.mjs +4 -4
- package/esm/function/once.mjs +0 -1
- package/esm/math/_virtual/_rollupPluginBabelHelpers.mjs +66 -0
- package/esm/math/clamp.mjs +15 -7
- package/esm/math/round.mjs +11 -8
- package/esm/math/sum.mjs +25 -14
- package/esm/object/_virtual/_rollupPluginBabelHelpers.mjs +37 -1
- package/esm/object/omit.mjs +13 -4
- package/esm/object/omitBy.mjs +32 -2
- package/esm/object/pick.mjs +13 -4
- package/esm/object/pickBy.mjs +32 -2
- package/esm/predicate/isNil.mjs +17 -3
- package/esm/predicate/isNotNil.mjs +7 -3
- package/esm/predicate/isNull.mjs +17 -2
- package/esm/predicate/isUndefined.mjs +17 -2
- package/esm/promise/delay.mjs +16 -3
- package/package.json +17 -3
- package/.vscode/extensions.json +0 -7
- package/.vscode/settings.json +0 -10
- package/.yarn/sdks/eslint/bin/eslint.js +0 -20
- package/.yarn/sdks/eslint/lib/api.js +0 -20
- package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -20
- package/.yarn/sdks/eslint/package.json +0 -14
- package/.yarn/sdks/integrations.yml +0 -5
- package/.yarn/sdks/prettier/bin/prettier.cjs +0 -20
- package/.yarn/sdks/prettier/index.cjs +0 -20
- package/.yarn/sdks/prettier/package.json +0 -7
- package/.yarn/sdks/typescript/bin/tsc +0 -20
- package/.yarn/sdks/typescript/bin/tsserver +0 -20
- package/.yarn/sdks/typescript/lib/tsc.js +0 -20
- package/.yarn/sdks/typescript/lib/tsserver.js +0 -225
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -225
- package/.yarn/sdks/typescript/lib/typescript.js +0 -20
- package/.yarn/sdks/typescript/package.json +0 -10
- package/babel.config.js +0 -6
- package/coverage/.tmp/coverage-0.json +0 -1
- package/coverage/.tmp/coverage-1.json +0 -1
- package/coverage/.tmp/coverage-10.json +0 -1
- package/coverage/.tmp/coverage-11.json +0 -1
- package/coverage/.tmp/coverage-12.json +0 -1
- package/coverage/.tmp/coverage-13.json +0 -1
- package/coverage/.tmp/coverage-14.json +0 -1
- package/coverage/.tmp/coverage-15.json +0 -1
- package/coverage/.tmp/coverage-16.json +0 -1
- package/coverage/.tmp/coverage-17.json +0 -1
- package/coverage/.tmp/coverage-18.json +0 -1
- package/coverage/.tmp/coverage-19.json +0 -1
- package/coverage/.tmp/coverage-2.json +0 -1
- package/coverage/.tmp/coverage-20.json +0 -1
- package/coverage/.tmp/coverage-21.json +0 -1
- package/coverage/.tmp/coverage-22.json +0 -1
- package/coverage/.tmp/coverage-23.json +0 -1
- package/coverage/.tmp/coverage-24.json +0 -1
- package/coverage/.tmp/coverage-25.json +0 -1
- package/coverage/.tmp/coverage-26.json +0 -1
- package/coverage/.tmp/coverage-27.json +0 -1
- package/coverage/.tmp/coverage-28.json +0 -1
- package/coverage/.tmp/coverage-29.json +0 -1
- package/coverage/.tmp/coverage-3.json +0 -1
- package/coverage/.tmp/coverage-30.json +0 -1
- package/coverage/.tmp/coverage-4.json +0 -1
- package/coverage/.tmp/coverage-5.json +0 -1
- package/coverage/.tmp/coverage-6.json +0 -1
- package/coverage/.tmp/coverage-7.json +0 -1
- package/coverage/.tmp/coverage-8.json +0 -1
- package/coverage/.tmp/coverage-9.json +0 -1
- package/rollup.config.js +0 -5
- package/src/array/chunk.spec.ts +0 -27
- package/src/array/chunk.ts +0 -24
- package/src/array/difference.spec.ts +0 -10
- package/src/array/difference.ts +0 -11
- package/src/array/differenceBy.spec.ts +0 -9
- package/src/array/differenceBy.ts +0 -14
- package/src/array/differenceWith.spec.ts +0 -8
- package/src/array/differenceWith.ts +0 -14
- package/src/array/drop.spec.ts +0 -9
- package/src/array/drop.ts +0 -9
- package/src/array/dropRight.spec.ts +0 -9
- package/src/array/dropRight.ts +0 -9
- package/src/array/dropRightWhile.spec.ts +0 -16
- package/src/array/dropRightWhile.ts +0 -13
- package/src/array/dropWhile.spec.ts +0 -14
- package/src/array/dropWhile.ts +0 -10
- package/src/array/groupBy.ts +0 -3
- package/src/array/index.ts +0 -30
- package/src/array/intersection.spec.ts +0 -11
- package/src/array/intersection.ts +0 -15
- package/src/array/intersectionBy.spec.ts +0 -9
- package/src/array/intersectionBy.ts +0 -18
- package/src/array/intersectionWith.spec.ts +0 -9
- package/src/array/intersectionWith.ts +0 -18
- package/src/array/partition.spec.ts +0 -23
- package/src/array/partition.ts +0 -21
- package/src/array/sample.spec.ts +0 -11
- package/src/array/sample.ts +0 -10
- package/src/array/shuffle.spec.ts +0 -11
- package/src/array/shuffle.ts +0 -18
- package/src/array/take.spec.ts +0 -25
- package/src/array/take.ts +0 -25
- package/src/array/takeRight.spec.ts +0 -25
- package/src/array/takeRight.ts +0 -29
- package/src/array/takeRightWhile.spec.ts +0 -16
- package/src/array/takeRightWhile.ts +0 -26
- package/src/array/takeWhile.spec.ts +0 -34
- package/src/array/takeWhile.ts +0 -31
- package/src/array/union.spec.ts +0 -10
- package/src/array/union.ts +0 -14
- package/src/array/unionBy.spec.ts +0 -12
- package/src/array/unionBy.ts +0 -35
- package/src/array/unionWith.spec.ts +0 -23
- package/src/array/unionWith.ts +0 -18
- package/src/array/uniq.spec.ts +0 -8
- package/src/array/uniq.ts +0 -16
- package/src/array/uniqBy.spec.ts +0 -8
- package/src/array/uniqBy.ts +0 -17
- package/src/array/uniqWith.spec.ts +0 -16
- package/src/array/uniqWith.ts +0 -29
- package/src/array/xor.spec.ts +0 -13
- package/src/array/xor.ts +0 -25
- package/src/array/xorBy.spec.ts +0 -16
- package/src/array/xorBy.ts +0 -29
- package/src/array/xorWith.spec.ts +0 -16
- package/src/array/xorWith.ts +0 -28
- package/src/array/zip.spec.ts +0 -14
- package/src/array/zip.ts +0 -34
- package/src/array/zipWith.spec.ts +0 -13
- package/src/array/zipWith.ts +0 -23
- package/src/function/debounce.spec.ts +0 -76
- package/src/function/debounce.ts +0 -42
- package/src/function/index.ts +0 -3
- package/src/function/once.spec.ts +0 -31
- package/src/function/once.ts +0 -34
- package/src/function/throttle.spec.ts +0 -32
- package/src/function/throttle.ts +0 -39
- package/src/index.ts +0 -6
- package/src/math/clamp.spec.ts +0 -18
- package/src/math/clamp.ts +0 -17
- package/src/math/index.ts +0 -3
- package/src/math/round.spec.ts +0 -53
- package/src/math/round.ts +0 -16
- package/src/math/sum.spec.ts +0 -29
- package/src/math/sum.ts +0 -17
- package/src/object/index.ts +0 -4
- package/src/object/omit.spec.ts +0 -10
- package/src/object/omit.ts +0 -15
- package/src/object/omitBy.ts +0 -3
- package/src/object/pick.spec.ts +0 -10
- package/src/object/pick.ts +0 -15
- package/src/object/pickBy.ts +0 -3
- package/src/predicate/index.ts +0 -4
- package/src/predicate/isNil.spec.ts +0 -23
- package/src/predicate/isNil.ts +0 -8
- package/src/predicate/isNotNil.spec.ts +0 -29
- package/src/predicate/isNotNil.ts +0 -14
- package/src/predicate/isNull.spec.ts +0 -23
- package/src/predicate/isNull.ts +0 -8
- package/src/predicate/isUndefined.spec.ts +0 -23
- package/src/predicate/isUndefined.ts +0 -8
- package/src/promise/delay.spec.ts +0 -13
- package/src/promise/delay.ts +0 -10
- package/src/promise/index.ts +0 -1
- package/tsconfig.json +0 -12
- package/vitest.config.mts +0 -13
package/esm/array/shuffle.mjs
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Randomizes the order of elements in an array using the Fisher-Yates algorithm.
|
|
3
|
+
*
|
|
4
|
+
* This function takes an array and returns a new array with its elements shuffled in a random order.
|
|
5
|
+
*
|
|
6
|
+
* @param {T[]} arr - The array to shuffle.
|
|
7
|
+
* @returns {T[]} A new array with its elements shuffled in random order.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const array = [1, 2, 3, 4, 5];
|
|
11
|
+
* const shuffledArray = shuffle(array);
|
|
12
|
+
* // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]
|
|
6
13
|
*/
|
|
7
14
|
function shuffle(arr) {
|
|
8
15
|
/**
|
|
9
16
|
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
|
|
10
17
|
*/
|
|
11
18
|
for (var i = arr.length - 1; i >= 1; i--) {
|
|
12
|
-
var j = Math.floor(Math.random() * i);
|
|
19
|
+
var j = Math.floor(Math.random() * (i + 1));
|
|
13
20
|
var _ref = [arr[j], arr[i]];
|
|
14
21
|
arr[i] = _ref[0];
|
|
15
22
|
arr[j] = _ref[1];
|
package/esm/array/takeRight.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a new array containing the last `count` elements from the input array `arr`.
|
|
3
3
|
* If `count` is greater than the length of `arr`, the entire array is returned.
|
|
4
|
-
*
|
|
5
|
-
* @template T - Type of elements in the input array.
|
|
6
4
|
*
|
|
7
5
|
* @param {T[]} arr - The array to take elements from.
|
|
8
6
|
* @param {number} count - The number of elements to take.
|
package/esm/array/union.mjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { uniq } from './uniq.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Creates an array of unique values from all given arrays.
|
|
5
|
+
*
|
|
6
|
+
* This function takes two arrays, merges them into a single array, and returns a new array
|
|
7
|
+
* containing only the unique values from the merged array.
|
|
8
|
+
*
|
|
9
|
+
* @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|
10
|
+
* @param {T[]} arr2 - The second array to merge and filter for unique values.
|
|
11
|
+
* @returns {T[]} A new array of unique values.
|
|
5
12
|
*
|
|
6
13
|
* @example
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
14
|
+
* const array1 = [1, 2, 3];
|
|
15
|
+
* const array2 = [3, 4, 5];
|
|
16
|
+
* const result = union(array1, array2);
|
|
17
|
+
* // result will be [1, 2, 3, 4, 5]
|
|
11
18
|
*/
|
|
12
|
-
function union() {
|
|
13
|
-
|
|
14
|
-
args[_key] = arguments[_key];
|
|
15
|
-
}
|
|
16
|
-
return uniq(args.flat());
|
|
19
|
+
function union(arr1, arr2) {
|
|
20
|
+
return uniq(arr1.concat(arr2));
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
export { union };
|
package/esm/array/unionBy.mjs
CHANGED
|
@@ -2,9 +2,6 @@ import { toConsumableArray as _toConsumableArray } from './_virtual/_rollupPlugi
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.
|
|
5
|
-
*
|
|
6
|
-
* @template T - Type of elements in the input arrays.
|
|
7
|
-
* @template U - Type of the values returned by the mapping function.
|
|
8
5
|
*
|
|
9
6
|
* @param {T[]} arr1 - The first array.
|
|
10
7
|
* @param {T[]} arr2 - The second array.
|
package/esm/array/unionWith.mjs
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { toConsumableArray as _toConsumableArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
1
|
import { uniqWith } from './uniqWith.mjs';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* Creates an array of unique values from two given arrays based on a custom equality function.
|
|
5
|
+
*
|
|
6
|
+
* This function takes two arrays and a custom equality function, merges the arrays, and returns
|
|
7
|
+
* a new array containing only the unique values as determined by the custom equality function.
|
|
8
|
+
*
|
|
9
|
+
* @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|
10
|
+
* @param {T[]} arr2 - The second array to merge and filter for unique values.
|
|
11
|
+
* @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.
|
|
12
|
+
* It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.
|
|
13
|
+
* @returns {T[]} A new array of unique values based on the custom equality function.
|
|
6
14
|
*
|
|
7
15
|
* @example
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* );
|
|
14
|
-
* // [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
|
15
|
-
* ```
|
|
16
|
+
* const array1 = [{ id: 1 }, { id: 2 }];
|
|
17
|
+
* const array2 = [{ id: 2 }, { id: 3 }];
|
|
18
|
+
* const areItemsEqual = (a, b) => a.id === b.id;
|
|
19
|
+
* const result = unionWith(array1, array2, areItemsEqual);
|
|
20
|
+
* // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays
|
|
16
21
|
*/
|
|
17
22
|
function unionWith(arr1, arr2, areItemsEqual) {
|
|
18
|
-
return uniqWith(
|
|
23
|
+
return uniqWith(arr1.concat(arr2), areItemsEqual);
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export { unionWith };
|
package/esm/array/uniq.mjs
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
|
+
import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Creates a duplicate-free version of an array.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an array and returns a new array containing only the unique values
|
|
7
|
+
* from the original array, preserving the order of first occurrence.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
9
|
+
* @param {T[]} arr - The array to process.
|
|
10
|
+
* @returns {T[]} A new array with only unique values from the original array.
|
|
7
11
|
*
|
|
8
12
|
* @example
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* // [1, 2, 3,
|
|
12
|
-
* ```
|
|
13
|
+
* * const array = [1, 2, 2, 3, 4, 4, 5];
|
|
14
|
+
* const result = uniq(array);
|
|
15
|
+
* // result will be [1, 2, 3, 4, 5]
|
|
13
16
|
*/
|
|
14
17
|
function uniq(arr) {
|
|
15
|
-
|
|
18
|
+
var result = [];
|
|
19
|
+
var _iterator = _createForOfIteratorHelper(arr),
|
|
20
|
+
_step;
|
|
21
|
+
try {
|
|
22
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
23
|
+
var item = _step.value;
|
|
24
|
+
if (result.includes(item)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
result.push(item);
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
_iterator.e(err);
|
|
31
|
+
} finally {
|
|
32
|
+
_iterator.f();
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
16
35
|
}
|
|
17
36
|
|
|
18
37
|
export { uniq };
|
package/esm/array/xor.mjs
CHANGED
|
@@ -5,8 +5,6 @@ import { union } from './union.mjs';
|
|
|
5
5
|
/**
|
|
6
6
|
* Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
|
|
7
7
|
* which are in either of the arrays, but not in their intersection.
|
|
8
|
-
*
|
|
9
|
-
* @template T - Type of elements in the input arrays.
|
|
10
8
|
*
|
|
11
9
|
* @param {T[]} arr1 - The first array.
|
|
12
10
|
* @param {T[]} arr2 - The second array.
|
package/esm/array/zip.mjs
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { toConsumableArray as _toConsumableArray, createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* elements from the input arrays at the corresponding index.
|
|
4
|
+
* Combines multiple arrays into a single array of tuples.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
|
7
|
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
|
8
|
+
* different lengths, the resulting array will have the length of the longest input array,
|
|
9
|
+
* with undefined values for missing elements.
|
|
10
|
+
*
|
|
11
|
+
* @param {...T[][]} arrs - The arrays to zip together.
|
|
12
|
+
* @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const arr1 = [1, 2, 3];
|
|
16
|
+
* const arr2 = ['a', 'b', 'c'];
|
|
17
|
+
* const result = zip(arr1, arr2);
|
|
18
|
+
* // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
|
|
19
|
+
*
|
|
20
|
+
* const arr3 = [true, false];
|
|
21
|
+
* const result2 = zip(arr1, arr2, arr3);
|
|
22
|
+
* // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
|
|
11
23
|
*/
|
|
12
24
|
|
|
13
25
|
function zip() {
|
package/esm/array/zipWith.mjs
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { toConsumableArray as _toConsumableArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Combines multiple arrays
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Combines multiple arrays into a single array using a custom combiner function.
|
|
5
|
+
*
|
|
6
|
+
* This function takes multiple arrays and a combiner function, and returns a new array where each element
|
|
7
|
+
* is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|
8
|
+
*
|
|
9
|
+
* @param {T[]} arr1 - The first array to zip.
|
|
10
|
+
* @param {U[]} [arr2] - The second array to zip (optional).
|
|
11
|
+
* @param {V[]} [arr3] - The third array to zip (optional).
|
|
12
|
+
* @param {W[]} [arr4] - The fourth array to zip (optional).
|
|
13
|
+
* @param {function} combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
|
14
|
+
* @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Example usage with two arrays:
|
|
18
|
+
* const arr1 = [1, 2, 3];
|
|
19
|
+
* const arr2 = [4, 5, 6];
|
|
20
|
+
* const result = zipWith(arr1, arr2, (a, b) => a + b);
|
|
21
|
+
* // result will be [5, 7, 9]
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Example usage with three arrays:
|
|
25
|
+
* const arr1 = [1, 2];
|
|
26
|
+
* const arr2 = [3, 4];
|
|
27
|
+
* const arr3 = [5, 6];
|
|
28
|
+
* const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);
|
|
29
|
+
* // result will be [`135`, `246`]
|
|
7
30
|
*/
|
|
8
31
|
|
|
9
32
|
function zipWith(arr1) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Creates a debounced function that delays invoking the provided function until after `
|
|
2
|
+
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
3
3
|
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
4
4
|
* method to cancel any pending execution.
|
|
5
5
|
*
|
|
6
6
|
* @param {() => void} func - The function to debounce.
|
|
7
|
-
* @param {number}
|
|
7
|
+
* @param {number} debounceMs - The number of milliseconds to delay.
|
|
8
8
|
* @returns {{ (): void; cancel: () => void }} A new debounced function with a `cancel` method.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* // Will not log anything as the previous call is canceled
|
|
19
19
|
* debouncedFunction.cancel();
|
|
20
20
|
*/
|
|
21
|
-
function debounce(func,
|
|
21
|
+
function debounce(func, debounceMs) {
|
|
22
22
|
var timeoutId = null;
|
|
23
23
|
var debounced = function debounced() {
|
|
24
24
|
if (timeoutId != null) {
|
|
@@ -26,7 +26,7 @@ function debounce(func, waitMs) {
|
|
|
26
26
|
}
|
|
27
27
|
timeoutId = setTimeout(function () {
|
|
28
28
|
func();
|
|
29
|
-
},
|
|
29
|
+
}, debounceMs);
|
|
30
30
|
};
|
|
31
31
|
debounced.cancel = function () {
|
|
32
32
|
if (timeoutId != null) {
|
package/esm/function/once.mjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Creates a function that is restricted to invoking the provided function `func` once.
|
|
3
3
|
* Repeated calls to the function will return the value from the first invocation.
|
|
4
4
|
*
|
|
5
|
-
* @template F - The type of the function to be invoked once.
|
|
6
5
|
* @param {F} func - The function to restrict.
|
|
7
6
|
* @returns {F} A new function that invokes `func` once and caches the result.
|
|
8
7
|
*
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
2
|
+
if (!o) return;
|
|
3
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
8
|
+
}
|
|
9
|
+
function _arrayLikeToArray(arr, len) {
|
|
10
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
11
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
12
|
+
return arr2;
|
|
13
|
+
}
|
|
14
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
15
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
16
|
+
if (!it) {
|
|
17
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
18
|
+
if (it) o = it;
|
|
19
|
+
var i = 0;
|
|
20
|
+
var F = function () {};
|
|
21
|
+
return {
|
|
22
|
+
s: F,
|
|
23
|
+
n: function () {
|
|
24
|
+
if (i >= o.length) return {
|
|
25
|
+
done: true
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
done: false,
|
|
29
|
+
value: o[i++]
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
e: function (e) {
|
|
33
|
+
throw e;
|
|
34
|
+
},
|
|
35
|
+
f: F
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39
|
+
}
|
|
40
|
+
var normalCompletion = true,
|
|
41
|
+
didErr = false,
|
|
42
|
+
err;
|
|
43
|
+
return {
|
|
44
|
+
s: function () {
|
|
45
|
+
it = it.call(o);
|
|
46
|
+
},
|
|
47
|
+
n: function () {
|
|
48
|
+
var step = it.next();
|
|
49
|
+
normalCompletion = step.done;
|
|
50
|
+
return step;
|
|
51
|
+
},
|
|
52
|
+
e: function (e) {
|
|
53
|
+
didErr = true;
|
|
54
|
+
err = e;
|
|
55
|
+
},
|
|
56
|
+
f: function () {
|
|
57
|
+
try {
|
|
58
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
59
|
+
} finally {
|
|
60
|
+
if (didErr) throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { _arrayLikeToArray as arrayLikeToArray, _createForOfIteratorHelper as createForOfIteratorHelper, _unsupportedIterableToArray as unsupportedIterableToArray };
|
package/esm/math/clamp.mjs
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* function
|
|
2
|
+
* Clamps a number within the inclusive lower and upper bounds.
|
|
3
|
+
*
|
|
4
|
+
* This function takes a number and two bounds, and returns the number clamped within the specified bounds.
|
|
5
|
+
* If only one bound is provided, it returns the minimum of the value and the bound.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} value - The number to clamp.
|
|
8
|
+
* @param {number} minimum - The minimum bound to clamp the number.
|
|
9
|
+
* @param {number} maximum - The maximum bound to clamp the number.
|
|
10
|
+
* @returns {number} The clamped number within the specified bounds.
|
|
11
|
+
*
|
|
5
12
|
* @example
|
|
6
|
-
* clamp(
|
|
7
|
-
* clamp(
|
|
8
|
-
* clamp(
|
|
9
|
-
* clamp(
|
|
13
|
+
* * const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
|
|
14
|
+
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
|
|
15
|
+
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
|
|
16
|
+
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
|
|
10
17
|
*/
|
|
18
|
+
|
|
11
19
|
function clamp(value, bound1, bound2) {
|
|
12
20
|
if (bound2 == null) {
|
|
13
21
|
return Math.min(value, bound1);
|
package/esm/math/round.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @description Rounds given number to given precision
|
|
4
|
-
* ```typescript
|
|
5
|
-
* function round(value: number, precision: number = 0): number
|
|
6
|
-
* ```
|
|
2
|
+
* Rounds a number to a specified precision.
|
|
7
3
|
*
|
|
4
|
+
* This function takes a number and an optional precision value, and returns the number rounded
|
|
5
|
+
* to the specified number of decimal places.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} value - The number to round.
|
|
8
|
+
* @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
|
|
9
|
+
* @returns {number} The rounded number.
|
|
10
|
+
*
|
|
8
11
|
* @example
|
|
9
|
-
* round(1.
|
|
10
|
-
* round(
|
|
11
|
-
* round(
|
|
12
|
+
* * const result1 = round(1.2345); // result1 will be 1
|
|
13
|
+
* const result2 = round(1.2345, 2); // result2 will be 1.23
|
|
14
|
+
* const result3 = round(1.2345, 3); // result3 will be 1.235
|
|
12
15
|
*/
|
|
13
16
|
function round(value) {
|
|
14
17
|
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
package/esm/math/sum.mjs
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
+
import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Calculates the sum of an array of numbers.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an array of numbers and returns the sum of all the elements in the array.
|
|
7
|
+
*
|
|
8
|
+
* @param {number[]} nums - An array of numbers to be summed.
|
|
9
|
+
* @returns {number} The sum of all the numbers in the array.
|
|
7
10
|
*
|
|
8
11
|
* @example
|
|
9
|
-
*
|
|
10
|
-
* sum(
|
|
11
|
-
*
|
|
12
|
+
* * const numbers = [1, 2, 3, 4, 5];
|
|
13
|
+
* const result = sum(numbers);
|
|
14
|
+
* // result will be 15
|
|
12
15
|
*/
|
|
13
|
-
function sum() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
function sum(nums) {
|
|
17
|
+
var result = 0;
|
|
18
|
+
var _iterator = _createForOfIteratorHelper(nums),
|
|
19
|
+
_step;
|
|
20
|
+
try {
|
|
21
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
22
|
+
var num = _step.value;
|
|
23
|
+
result += num;
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
_iterator.e(err);
|
|
27
|
+
} finally {
|
|
28
|
+
_iterator.f();
|
|
16
29
|
}
|
|
17
|
-
return
|
|
18
|
-
return acc + curr;
|
|
19
|
-
}, 0);
|
|
30
|
+
return result;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
export { sum };
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
function _iterableToArrayLimit(r, l) {
|
|
2
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
3
|
+
if (null != t) {
|
|
4
|
+
var e,
|
|
5
|
+
n,
|
|
6
|
+
i,
|
|
7
|
+
u,
|
|
8
|
+
a = [],
|
|
9
|
+
f = !0,
|
|
10
|
+
o = !1;
|
|
11
|
+
try {
|
|
12
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
13
|
+
if (Object(t) !== t) return;
|
|
14
|
+
f = !1;
|
|
15
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
16
|
+
} catch (r) {
|
|
17
|
+
o = !0, n = r;
|
|
18
|
+
} finally {
|
|
19
|
+
try {
|
|
20
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
21
|
+
} finally {
|
|
22
|
+
if (o) throw n;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
1
28
|
function ownKeys(e, r) {
|
|
2
29
|
var t = Object.keys(e);
|
|
3
30
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -47,6 +74,12 @@ function _defineProperty(obj, key, value) {
|
|
|
47
74
|
}
|
|
48
75
|
return obj;
|
|
49
76
|
}
|
|
77
|
+
function _slicedToArray(arr, i) {
|
|
78
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
79
|
+
}
|
|
80
|
+
function _arrayWithHoles(arr) {
|
|
81
|
+
if (Array.isArray(arr)) return arr;
|
|
82
|
+
}
|
|
50
83
|
function _unsupportedIterableToArray(o, minLen) {
|
|
51
84
|
if (!o) return;
|
|
52
85
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -60,6 +93,9 @@ function _arrayLikeToArray(arr, len) {
|
|
|
60
93
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
61
94
|
return arr2;
|
|
62
95
|
}
|
|
96
|
+
function _nonIterableRest() {
|
|
97
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
98
|
+
}
|
|
63
99
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
64
100
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
65
101
|
if (!it) {
|
|
@@ -112,4 +148,4 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
112
148
|
};
|
|
113
149
|
}
|
|
114
150
|
|
|
115
|
-
export { _arrayLikeToArray as arrayLikeToArray, _createForOfIteratorHelper as createForOfIteratorHelper, _defineProperty as defineProperty, _objectSpread2 as objectSpread2, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };
|
|
151
|
+
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _createForOfIteratorHelper as createForOfIteratorHelper, _defineProperty as defineProperty, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _objectSpread2 as objectSpread2, _slicedToArray as slicedToArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };
|
package/esm/object/omit.mjs
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2, createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Creates a new object with specified keys omitted.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an object and an array of keys, and returns a new object that
|
|
7
|
+
* excludes the properties corresponding to the specified keys.
|
|
8
|
+
*
|
|
9
|
+
* @param {T} obj - The object to omit keys from.
|
|
10
|
+
* @param {K[]} keys - An array of keys to be omitted from the object.
|
|
11
|
+
* @returns {Omit<T, K>} A new object with the specified keys omitted.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* * const obj = { a: 1, b: 2, c: 3 };
|
|
15
|
+
* const result = omit(obj, ['b', 'c']);
|
|
16
|
+
* // result will be { a: 1 }
|
|
8
17
|
*/
|
|
9
18
|
function omit(obj, keys) {
|
|
10
19
|
var result = _objectSpread2({}, obj);
|
package/esm/object/omitBy.mjs
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { slicedToArray as _slicedToArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new object composed of the properties that do not satisfy the predicate function.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an object and a predicate function, and returns a new object that
|
|
7
|
+
* includes only the properties for which the predicate function returns false.
|
|
8
|
+
*
|
|
9
|
+
* @param {T} obj - The object to omit properties from.
|
|
10
|
+
* @param {(value: T[string], key: string) => boolean} shouldOmit - A predicate function that determines
|
|
11
|
+
* whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
|
|
12
|
+
* if the property should be omitted, and `false` otherwise.
|
|
13
|
+
* @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const obj = { a: 1, b: 'omit', c: 3 };
|
|
17
|
+
* const shouldOmit = (key, value) => typeof value === 'string';
|
|
18
|
+
* const result = omitBy(obj, shouldOmit);
|
|
19
|
+
* // result will be { a: 1, c: 3 }
|
|
20
|
+
*/
|
|
21
|
+
function omitBy(obj, shouldOmit) {
|
|
22
|
+
var result = {};
|
|
23
|
+
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
24
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
25
|
+
key = _Object$entries$_i[0],
|
|
26
|
+
value = _Object$entries$_i[1];
|
|
27
|
+
if (shouldOmit(value, key)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
result[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
3
33
|
}
|
|
4
34
|
|
|
5
35
|
export { omitBy };
|
package/esm/object/pick.mjs
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { createForOfIteratorHelper as _createForOfIteratorHelper } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Creates a new object composed of the picked object properties.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an object and an array of keys, and returns a new object that
|
|
7
|
+
* includes only the properties corresponding to the specified keys.
|
|
8
|
+
*
|
|
9
|
+
* @param {T} obj - The object to pick keys from.
|
|
10
|
+
* @param {K[]} keys - An array of keys to be picked from the object.
|
|
11
|
+
* @returns {Pick<T, K>} A new object with the specified keys picked.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* * const obj = { a: 1, b: 2, c: 3 };
|
|
15
|
+
* const result = pick(obj, ['a', 'c']);
|
|
16
|
+
* // result will be { a: 1, c: 3 }
|
|
8
17
|
*/
|
|
9
18
|
function pick(obj, keys) {
|
|
10
19
|
var result = {};
|
package/esm/object/pickBy.mjs
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { slicedToArray as _slicedToArray } from './_virtual/_rollupPluginBabelHelpers.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new object composed of the properties that satisfy the predicate function.
|
|
5
|
+
*
|
|
6
|
+
* This function takes an object and a predicate function, and returns a new object that
|
|
7
|
+
* includes only the properties for which the predicate function returns true.
|
|
8
|
+
*
|
|
9
|
+
* @param {T} obj - The object to pick properties from.
|
|
10
|
+
* @param {(value: T[keyof T], key: string) => boolean} shouldPick - A predicate function that determines
|
|
11
|
+
* whether a property should be picked. It takes the property's key and value as arguments and returns `true`
|
|
12
|
+
* if the property should be picked, and `false` otherwise.
|
|
13
|
+
* @returns {Partial<T>} A new object with the properties that satisfy the predicate function.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const obj = { a: 1, b: 'pick', c: 3 };
|
|
17
|
+
* const shouldPick = (value) => typeof value === 'string';
|
|
18
|
+
* const result = pickBy(obj, shouldPick);
|
|
19
|
+
* // result will be { b: 'pick' }
|
|
20
|
+
*/
|
|
21
|
+
function pickBy(obj, shouldPick) {
|
|
22
|
+
var result = {};
|
|
23
|
+
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
24
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
25
|
+
key = _Object$entries$_i[0],
|
|
26
|
+
value = _Object$entries$_i[1];
|
|
27
|
+
if (!shouldPick(value, key)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
result[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
3
33
|
}
|
|
4
34
|
|
|
5
35
|
export { pickBy };
|