es-toolkit 1.50.0 → 1.51.0-dev.2065
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 +82 -0
- package/NOTICE +39 -0
- package/README.md +2 -2
- package/bigint.d.ts +1 -0
- package/bigint.js +1 -0
- package/dist/_internal/NonPlainObject.d.mts +8 -0
- package/dist/_internal/NonPlainObject.d.ts +8 -0
- package/dist/_internal/bigIntRangeLength.js +19 -0
- package/dist/_internal/bigIntRangeLength.mjs +19 -0
- package/dist/_internal/isMergeableValue.js +17 -0
- package/dist/_internal/isMergeableValue.mjs +17 -0
- package/dist/_internal/isUnsafeProperty.js +7 -4
- package/dist/_internal/isUnsafeProperty.mjs +7 -4
- package/dist/_internal/isUnsafeToWriteProperty.js +22 -0
- package/dist/_internal/isUnsafeToWriteProperty.mjs +22 -0
- package/dist/array/at.d.mts +1 -1
- package/dist/array/at.d.ts +1 -1
- package/dist/array/filterAsync.js +1 -1
- package/dist/array/filterAsync.mjs +1 -1
- package/dist/array/flatMapAsync.js +1 -1
- package/dist/array/flatMapAsync.mjs +1 -1
- package/dist/array/forEachAsync.js +1 -1
- package/dist/array/forEachAsync.mjs +1 -1
- package/dist/array/index.js +1 -1
- package/dist/array/index.mjs +1 -1
- package/dist/array/limitAsync.d.mts +4 -28
- package/dist/array/limitAsync.d.ts +4 -28
- package/dist/array/limitAsync.js +2 -39
- package/dist/array/limitAsync.mjs +3 -39
- package/dist/array/mapAsync.js +1 -1
- package/dist/array/mapAsync.mjs +1 -1
- package/dist/array/orderBy.d.mts +1 -1
- package/dist/array/orderBy.d.ts +1 -1
- package/dist/array/pullAt.d.mts +1 -1
- package/dist/array/pullAt.d.ts +1 -1
- package/dist/array/pullAt.js +1 -1
- package/dist/array/pullAt.mjs +1 -1
- package/dist/array/sortBy.d.mts +1 -1
- package/dist/array/sortBy.d.ts +1 -1
- package/dist/array/unzip.d.mts +3 -0
- package/dist/array/unzip.d.ts +3 -0
- package/dist/array/unzip.js +3 -0
- package/dist/array/unzip.mjs +3 -0
- package/dist/bigint/clamp.d.mts +37 -0
- package/dist/bigint/clamp.d.ts +37 -0
- package/dist/bigint/clamp.js +16 -0
- package/dist/bigint/clamp.mjs +16 -0
- package/dist/bigint/inRange.d.mts +37 -0
- package/dist/bigint/inRange.d.ts +37 -0
- package/dist/bigint/inRange.js +20 -0
- package/dist/bigint/inRange.mjs +20 -0
- package/dist/bigint/index.d.mts +14 -0
- package/dist/bigint/index.d.ts +14 -0
- package/dist/bigint/index.js +27 -0
- package/dist/bigint/index.mjs +14 -0
- package/dist/bigint/max.d.mts +21 -0
- package/dist/bigint/max.d.ts +21 -0
- package/dist/bigint/max.js +26 -0
- package/dist/bigint/max.mjs +26 -0
- package/dist/bigint/maxBy.d.mts +21 -0
- package/dist/bigint/maxBy.d.ts +21 -0
- package/dist/bigint/maxBy.js +34 -0
- package/dist/bigint/maxBy.mjs +34 -0
- package/dist/bigint/median.d.mts +22 -0
- package/dist/bigint/median.d.ts +22 -0
- package/dist/bigint/median.js +28 -0
- package/dist/bigint/median.mjs +28 -0
- package/dist/bigint/medianBy.d.mts +21 -0
- package/dist/bigint/medianBy.d.ts +21 -0
- package/dist/bigint/medianBy.js +24 -0
- package/dist/bigint/medianBy.mjs +24 -0
- package/dist/bigint/min.d.mts +18 -0
- package/dist/bigint/min.d.ts +18 -0
- package/dist/bigint/min.js +23 -0
- package/dist/bigint/min.mjs +23 -0
- package/dist/bigint/minBy.d.mts +21 -0
- package/dist/bigint/minBy.d.ts +21 -0
- package/dist/bigint/minBy.js +34 -0
- package/dist/bigint/minBy.mjs +34 -0
- package/dist/bigint/percentile.d.mts +23 -0
- package/dist/bigint/percentile.d.ts +23 -0
- package/dist/bigint/percentile.js +31 -0
- package/dist/bigint/percentile.mjs +31 -0
- package/dist/bigint/range.d.mts +45 -0
- package/dist/bigint/range.d.ts +45 -0
- package/dist/bigint/range.js +24 -0
- package/dist/bigint/range.mjs +24 -0
- package/dist/bigint/rangeRight.d.mts +43 -0
- package/dist/bigint/rangeRight.d.ts +43 -0
- package/dist/bigint/rangeRight.js +25 -0
- package/dist/bigint/rangeRight.mjs +25 -0
- package/dist/bigint/sum.d.mts +18 -0
- package/dist/bigint/sum.d.ts +18 -0
- package/dist/bigint/sum.js +22 -0
- package/dist/bigint/sum.mjs +22 -0
- package/dist/bigint/sumBy.d.mts +20 -0
- package/dist/bigint/sumBy.d.ts +20 -0
- package/dist/bigint/sumBy.js +24 -0
- package/dist/bigint/sumBy.mjs +24 -0
- package/dist/browser.global.js +6 -3
- package/dist/compat/_internal/normalizeZero.js +13 -0
- package/dist/compat/_internal/normalizeZero.mjs +13 -0
- package/dist/compat/_internal/toKey.js +1 -1
- package/dist/compat/_internal/toKey.mjs +1 -1
- package/dist/compat/_internal/unicodeSize.js +45 -0
- package/dist/compat/_internal/unicodeSize.mjs +45 -0
- package/dist/compat/array/chunk.js +1 -0
- package/dist/compat/array/chunk.mjs +1 -0
- package/dist/compat/array/difference.js +2 -1
- package/dist/compat/array/difference.mjs +2 -1
- package/dist/compat/array/differenceBy.js +3 -2
- package/dist/compat/array/differenceBy.mjs +3 -2
- package/dist/compat/array/drop.d.mts +1 -1
- package/dist/compat/array/drop.d.ts +1 -1
- package/dist/compat/array/dropRight.d.mts +2 -3
- package/dist/compat/array/dropRight.d.ts +2 -3
- package/dist/compat/array/dropRight.js +4 -4
- package/dist/compat/array/dropRight.mjs +4 -4
- package/dist/compat/array/every.js +9 -9
- package/dist/compat/array/every.mjs +9 -9
- package/dist/compat/array/fill.js +8 -2
- package/dist/compat/array/fill.mjs +8 -2
- package/dist/compat/array/find.js +14 -13
- package/dist/compat/array/find.mjs +14 -13
- package/dist/compat/array/findIndex.js +3 -19
- package/dist/compat/array/findIndex.mjs +3 -19
- package/dist/compat/array/findLast.js +3 -3
- package/dist/compat/array/findLast.mjs +3 -3
- package/dist/compat/array/flatMap.js +3 -8
- package/dist/compat/array/flatMap.mjs +3 -7
- package/dist/compat/array/flatMapDepth.js +1 -1
- package/dist/compat/array/flatMapDepth.mjs +1 -1
- package/dist/compat/array/forEach.js +1 -1
- package/dist/compat/array/forEach.mjs +1 -1
- package/dist/compat/array/includes.js +13 -13
- package/dist/compat/array/includes.mjs +13 -13
- package/dist/compat/array/indexOf.js +2 -1
- package/dist/compat/array/indexOf.mjs +2 -1
- package/dist/compat/array/intersection.js +3 -2
- package/dist/compat/array/intersection.mjs +3 -2
- package/dist/compat/array/intersectionBy.js +7 -11
- package/dist/compat/array/intersectionBy.mjs +7 -11
- package/dist/compat/array/intersectionWith.js +6 -18
- package/dist/compat/array/intersectionWith.mjs +6 -18
- package/dist/compat/array/last.js +1 -1
- package/dist/compat/array/last.mjs +1 -1
- package/dist/compat/array/lastIndexOf.js +3 -1
- package/dist/compat/array/lastIndexOf.mjs +3 -1
- package/dist/compat/array/map.js +3 -3
- package/dist/compat/array/map.mjs +3 -3
- package/dist/compat/array/orderBy.js +8 -6
- package/dist/compat/array/orderBy.mjs +8 -6
- package/dist/compat/array/partition.js +6 -6
- package/dist/compat/array/partition.mjs +6 -6
- package/dist/compat/array/pull.js +1 -1
- package/dist/compat/array/pull.mjs +1 -1
- package/dist/compat/array/pullAll.js +2 -0
- package/dist/compat/array/pullAll.mjs +2 -0
- package/dist/compat/array/remove.js +8 -4
- package/dist/compat/array/remove.mjs +8 -4
- package/dist/compat/array/reverse.js +1 -1
- package/dist/compat/array/reverse.mjs +1 -1
- package/dist/compat/array/sampleSize.js +2 -1
- package/dist/compat/array/sampleSize.mjs +2 -1
- package/dist/compat/array/size.js +2 -1
- package/dist/compat/array/size.mjs +2 -1
- package/dist/compat/array/some.js +2 -1
- package/dist/compat/array/some.mjs +2 -1
- package/dist/compat/array/takeRightWhile.js +2 -2
- package/dist/compat/array/takeRightWhile.mjs +2 -2
- package/dist/compat/array/takeWhile.js +2 -2
- package/dist/compat/array/takeWhile.mjs +2 -2
- package/dist/compat/array/unionBy.js +2 -1
- package/dist/compat/array/unionBy.mjs +2 -1
- package/dist/compat/array/uniqBy.js +4 -3
- package/dist/compat/array/uniqBy.mjs +4 -3
- package/dist/compat/array/unzip.d.mts +3 -0
- package/dist/compat/array/unzip.d.ts +3 -0
- package/dist/compat/array/unzip.js +3 -0
- package/dist/compat/array/unzip.mjs +3 -0
- package/dist/compat/array/unzipWith.js +1 -1
- package/dist/compat/array/unzipWith.mjs +1 -1
- package/dist/compat/array/zipObject.js +2 -0
- package/dist/compat/array/zipObject.mjs +2 -0
- package/dist/compat/compat.d.mts +3 -3
- package/dist/compat/compat.d.ts +3 -3
- package/dist/compat/compat.js +8 -4
- package/dist/compat/compat.mjs +8 -4
- package/dist/compat/function/curry.d.mts +1 -1
- package/dist/compat/function/curry.d.ts +1 -1
- package/dist/compat/function/flowRight.d.mts +1 -1
- package/dist/compat/function/flowRight.d.ts +1 -1
- package/dist/compat/function/partial.d.mts +1 -1
- package/dist/compat/function/partial.d.ts +1 -1
- package/dist/compat/function/rest.d.mts +1 -1
- package/dist/compat/function/rest.d.ts +1 -1
- package/dist/compat/function/rest.js +1 -1
- package/dist/compat/function/rest.mjs +1 -1
- package/dist/compat/index.d.mts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +6 -4
- package/dist/compat/index.mjs +5 -5
- package/dist/compat/math/maxBy.js +1 -1
- package/dist/compat/math/maxBy.mjs +1 -1
- package/dist/compat/math/meanBy.d.mts +4 -0
- package/dist/compat/math/meanBy.d.ts +4 -0
- package/dist/compat/math/meanBy.js +8 -3
- package/dist/compat/math/meanBy.mjs +8 -3
- package/dist/compat/math/minBy.js +1 -1
- package/dist/compat/math/minBy.mjs +1 -1
- package/dist/compat/object/cloneDeep.d.mts +5 -5
- package/dist/compat/object/cloneDeep.d.ts +5 -5
- package/dist/compat/object/cloneDeep.js +5 -5
- package/dist/compat/object/cloneDeep.mjs +5 -5
- package/dist/compat/object/cloneDeepWith.js +3 -1
- package/dist/compat/object/cloneDeepWith.mjs +3 -1
- package/dist/compat/object/cloneWith.d.mts +1 -1
- package/dist/compat/object/cloneWith.d.ts +1 -1
- package/dist/compat/object/cloneWith.js +1 -1
- package/dist/compat/object/cloneWith.mjs +1 -1
- package/dist/compat/object/entries.d.mts +1 -0
- package/dist/compat/object/entries.d.ts +1 -0
- package/dist/compat/object/entries.js +1 -0
- package/dist/compat/object/entries.mjs +1 -0
- package/dist/compat/object/entriesIn.d.mts +1 -0
- package/dist/compat/object/entriesIn.d.ts +1 -0
- package/dist/compat/object/entriesIn.js +1 -0
- package/dist/compat/object/entriesIn.mjs +1 -0
- package/dist/compat/object/omit.js +5 -5
- package/dist/compat/object/omit.mjs +5 -5
- package/dist/compat/object/transform.js +1 -1
- package/dist/compat/object/transform.mjs +1 -1
- package/dist/compat/object/updateWith.js +2 -2
- package/dist/compat/object/updateWith.mjs +2 -2
- package/dist/compat/predicate/isMatchWith.js +14 -5
- package/dist/compat/predicate/isMatchWith.mjs +14 -5
- package/dist/compat/string/template.js +2 -1
- package/dist/compat/string/template.mjs +2 -1
- package/dist/compat/string/words.js +17 -13
- package/dist/compat/string/words.mjs +17 -13
- package/dist/compat/util/iteratee.js +1 -3
- package/dist/compat/util/iteratee.mjs +1 -3
- package/dist/compat/util/toArray.d.mts +5 -5
- package/dist/compat/util/toArray.d.ts +5 -5
- package/dist/compat/util/toArray.js +9 -5
- package/dist/compat/util/toArray.mjs +9 -5
- package/dist/compat/util/toPath.js +11 -3
- package/dist/compat/util/toPath.mjs +11 -3
- package/dist/compat/util/toString.js +4 -1
- package/dist/compat/util/toString.mjs +4 -1
- package/dist/fp/array/at.d.mts +1 -1
- package/dist/fp/array/at.d.ts +1 -1
- package/dist/fp/array/orderBy.d.mts +1 -1
- package/dist/fp/array/orderBy.d.ts +1 -1
- package/dist/fp/array/sortBy.d.mts +1 -1
- package/dist/fp/array/sortBy.d.ts +1 -1
- package/dist/fp/array/unzip.d.mts +3 -0
- package/dist/fp/array/unzip.d.ts +3 -0
- package/dist/fp/array/unzip.js +3 -0
- package/dist/fp/array/unzip.mjs +3 -0
- package/dist/function/memoize.d.mts +3 -2
- package/dist/function/memoize.d.ts +3 -2
- package/dist/function/memoize.js +3 -2
- package/dist/function/memoize.mjs +3 -2
- package/dist/function/partial.d.mts +2 -2
- package/dist/function/partial.d.ts +2 -2
- package/dist/function/partialRight.d.mts +5 -5
- package/dist/function/partialRight.d.ts +5 -5
- package/dist/function/rest.d.mts +1 -1
- package/dist/function/rest.d.ts +1 -1
- package/dist/function/rest.js +1 -1
- package/dist/function/rest.mjs +1 -1
- package/dist/function/retry.d.mts +7 -4
- package/dist/function/retry.d.ts +7 -4
- package/dist/function/retry.js +4 -2
- package/dist/function/retry.mjs +1 -1
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +18 -4
- package/dist/index.mjs +12 -5
- package/dist/object/cloneDeepWith.d.mts +3 -1
- package/dist/object/cloneDeepWith.d.ts +3 -1
- package/dist/object/cloneDeepWith.js +3 -1
- package/dist/object/cloneDeepWith.mjs +3 -1
- package/dist/object/deepFreeze.d.mts +20 -0
- package/dist/object/deepFreeze.d.ts +20 -0
- package/dist/object/deepFreeze.js +29 -0
- package/dist/object/deepFreeze.mjs +29 -0
- package/dist/object/flattenObject.d.mts +16 -1
- package/dist/object/flattenObject.d.ts +16 -1
- package/dist/object/flattenObject.js +15 -6
- package/dist/object/flattenObject.mjs +15 -6
- package/dist/object/index.d.mts +7 -1
- package/dist/object/index.d.ts +7 -1
- package/dist/object/index.js +12 -0
- package/dist/object/index.mjs +7 -1
- package/dist/object/mapKeysAsync.d.mts +25 -0
- package/dist/object/mapKeysAsync.d.ts +25 -0
- package/dist/object/mapKeysAsync.js +32 -0
- package/dist/object/mapKeysAsync.mjs +32 -0
- package/dist/object/mapValuesAsync.d.mts +26 -0
- package/dist/object/mapValuesAsync.d.ts +26 -0
- package/dist/object/mapValuesAsync.js +32 -0
- package/dist/object/mapValuesAsync.mjs +32 -0
- package/dist/object/merge.js +2 -4
- package/dist/object/merge.mjs +1 -3
- package/dist/object/mergeWith.js +4 -4
- package/dist/object/mergeWith.mjs +4 -4
- package/dist/object/toCamelCaseKeys.d.mts +2 -6
- package/dist/object/toCamelCaseKeys.d.ts +2 -6
- package/dist/object/toConstantCaseKeys.d.mts +52 -0
- package/dist/object/toConstantCaseKeys.d.ts +52 -0
- package/dist/object/toConstantCaseKeys.js +66 -0
- package/dist/object/toConstantCaseKeys.mjs +66 -0
- package/dist/object/toKebabCaseKeys.d.mts +52 -0
- package/dist/object/toKebabCaseKeys.d.ts +52 -0
- package/dist/object/toKebabCaseKeys.js +66 -0
- package/dist/object/toKebabCaseKeys.mjs +66 -0
- package/dist/object/toMerged.js +4 -4
- package/dist/object/toMerged.mjs +4 -4
- package/dist/object/toPascalCaseKeys.d.mts +52 -0
- package/dist/object/toPascalCaseKeys.d.ts +52 -0
- package/dist/object/toPascalCaseKeys.js +66 -0
- package/dist/object/toPascalCaseKeys.mjs +66 -0
- package/dist/object/toSnakeCaseKeys.d.mts +2 -3
- package/dist/object/toSnakeCaseKeys.d.ts +2 -3
- package/dist/promise/index.d.mts +2 -1
- package/dist/promise/index.d.ts +2 -1
- package/dist/promise/index.js +2 -0
- package/dist/promise/index.mjs +2 -1
- package/dist/promise/limitAsync.d.mts +35 -0
- package/dist/promise/limitAsync.d.ts +35 -0
- package/dist/promise/limitAsync.js +46 -0
- package/dist/promise/limitAsync.mjs +46 -0
- package/dist/string/dedent.d.mts +37 -0
- package/dist/string/dedent.d.ts +37 -0
- package/dist/string/dedent.js +38 -0
- package/dist/string/dedent.mjs +38 -0
- package/dist/string/index.d.mts +2 -1
- package/dist/string/index.d.ts +2 -1
- package/dist/string/index.js +5 -3
- package/dist/string/index.mjs +5 -4
- package/dist/types/ToCamelCaseKeys.d.mts +24 -0
- package/dist/types/ToCamelCaseKeys.d.ts +24 -0
- package/dist/types/ToConstantCaseKeys.d.mts +21 -0
- package/dist/types/ToConstantCaseKeys.d.ts +21 -0
- package/dist/types/ToKebabCaseKeys.d.mts +23 -0
- package/dist/types/ToKebabCaseKeys.d.ts +23 -0
- package/dist/types/ToPascalCaseKeys.d.mts +24 -0
- package/dist/types/ToPascalCaseKeys.d.ts +24 -0
- package/dist/types/ToSnakeCaseKeys.d.mts +21 -0
- package/dist/types/ToSnakeCaseKeys.d.ts +21 -0
- package/dist/types/index.d.mts +6 -1
- package/dist/types/index.d.ts +6 -1
- package/package.json +27 -2
|
@@ -24,7 +24,8 @@ const require_toArray = require("../util/toArray.js");
|
|
|
24
24
|
function sampleSize(collection, size, guard) {
|
|
25
25
|
const arrayCollection = require_toArray.toArray(collection);
|
|
26
26
|
if (guard ? require_isIterateeCall.isIterateeCall(collection, size, guard) : size === void 0) size = 1;
|
|
27
|
-
else size =
|
|
27
|
+
else size = require_toInteger.toInteger(size);
|
|
28
|
+
size = require_clamp.clamp(size, 0, arrayCollection.length);
|
|
28
29
|
return require_sampleSize.sampleSize(arrayCollection, size);
|
|
29
30
|
}
|
|
30
31
|
//#endregion
|
|
@@ -24,7 +24,8 @@ import { toArray } from "../util/toArray.mjs";
|
|
|
24
24
|
function sampleSize(collection, size, guard) {
|
|
25
25
|
const arrayCollection = toArray(collection);
|
|
26
26
|
if (guard ? isIterateeCall(collection, size, guard) : size === void 0) size = 1;
|
|
27
|
-
else size =
|
|
27
|
+
else size = toInteger(size);
|
|
28
|
+
size = clamp(size, 0, arrayCollection.length);
|
|
28
29
|
return sampleSize$1(arrayCollection, size);
|
|
29
30
|
}
|
|
30
31
|
//#endregion
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const require_isNil = require("../../predicate/isNil.js");
|
|
2
2
|
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
|
3
3
|
const require_regexMultiByte = require("../_internal/regexMultiByte.js");
|
|
4
|
+
const require_unicodeSize = require("../_internal/unicodeSize.js");
|
|
4
5
|
//#region src/compat/array/size.ts
|
|
5
6
|
function size(target) {
|
|
6
7
|
if (require_isNil.isNil(target)) return 0;
|
|
7
|
-
if (typeof target === "string") return require_regexMultiByte.regexMultiByte.test(target) ?
|
|
8
|
+
if (typeof target === "string") return require_regexMultiByte.regexMultiByte.test(target) ? require_unicodeSize.unicodeSize(target) : target.length;
|
|
8
9
|
if (require_isArrayLike.isArrayLike(target)) return target.length;
|
|
9
10
|
if (target instanceof Map || target instanceof Set) return target.size;
|
|
10
11
|
return Object.keys(target).length;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isNil } from "../../predicate/isNil.mjs";
|
|
2
2
|
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
|
3
3
|
import { regexMultiByte } from "../_internal/regexMultiByte.mjs";
|
|
4
|
+
import { unicodeSize } from "../_internal/unicodeSize.mjs";
|
|
4
5
|
//#region src/compat/array/size.ts
|
|
5
6
|
function size(target) {
|
|
6
7
|
if (isNil(target)) return 0;
|
|
7
|
-
if (typeof target === "string") return regexMultiByte.test(target) ?
|
|
8
|
+
if (typeof target === "string") return regexMultiByte.test(target) ? unicodeSize(target) : target.length;
|
|
8
9
|
if (isArrayLike(target)) return target.length;
|
|
9
10
|
if (target instanceof Map || target instanceof Set) return target.size;
|
|
10
11
|
return Object.keys(target).length;
|
|
@@ -2,6 +2,7 @@ const require_identity = require("../../function/identity.js");
|
|
|
2
2
|
const require_property = require("../object/property.js");
|
|
3
3
|
const require_matches = require("../predicate/matches.js");
|
|
4
4
|
const require_matchesProperty = require("../predicate/matchesProperty.js");
|
|
5
|
+
const require_isIterateeCall = require("../_internal/isIterateeCall.js");
|
|
5
6
|
//#region src/compat/array/some.ts
|
|
6
7
|
/**
|
|
7
8
|
* Checks if there is an element in an array that matches the given predicate.
|
|
@@ -41,7 +42,7 @@ const require_matchesProperty = require("../predicate/matchesProperty.js");
|
|
|
41
42
|
*/
|
|
42
43
|
function some(source, predicate, guard) {
|
|
43
44
|
if (!source) return false;
|
|
44
|
-
if (guard
|
|
45
|
+
if (guard && require_isIterateeCall.isIterateeCall(source, predicate, guard)) predicate = void 0;
|
|
45
46
|
if (predicate == null) predicate = require_identity.identity;
|
|
46
47
|
const values = Array.isArray(source) ? source : Object.values(source);
|
|
47
48
|
switch (typeof predicate) {
|
|
@@ -2,6 +2,7 @@ import { identity } from "../../function/identity.mjs";
|
|
|
2
2
|
import { property } from "../object/property.mjs";
|
|
3
3
|
import { matches } from "../predicate/matches.mjs";
|
|
4
4
|
import { matchesProperty } from "../predicate/matchesProperty.mjs";
|
|
5
|
+
import { isIterateeCall } from "../_internal/isIterateeCall.mjs";
|
|
5
6
|
//#region src/compat/array/some.ts
|
|
6
7
|
/**
|
|
7
8
|
* Checks if there is an element in an array that matches the given predicate.
|
|
@@ -41,7 +42,7 @@ import { matchesProperty } from "../predicate/matchesProperty.mjs";
|
|
|
41
42
|
*/
|
|
42
43
|
function some(source, predicate, guard) {
|
|
43
44
|
if (!source) return false;
|
|
44
|
-
if (guard
|
|
45
|
+
if (guard && isIterateeCall(source, predicate, guard)) predicate = void 0;
|
|
45
46
|
if (predicate == null) predicate = identity;
|
|
46
47
|
const values = Array.isArray(source) ? source : Object.values(source);
|
|
47
48
|
switch (typeof predicate) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_identity = require("../../function/identity.js");
|
|
2
2
|
const require_negate = require("../../function/negate.js");
|
|
3
3
|
const require_toArray = require("../_internal/toArray.js");
|
|
4
|
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
|
4
5
|
const require_iteratee = require("../util/iteratee.js");
|
|
5
|
-
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
6
6
|
//#region src/compat/array/takeRightWhile.ts
|
|
7
7
|
/**
|
|
8
8
|
* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied.
|
|
@@ -50,7 +50,7 @@ const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
|
50
50
|
* console.log(result6); // []
|
|
51
51
|
*/
|
|
52
52
|
function takeRightWhile(_array, predicate) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!require_isArrayLike.isArrayLike(_array)) return [];
|
|
54
54
|
const array = require_toArray.toArray(_array);
|
|
55
55
|
const index = array.findLastIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity)));
|
|
56
56
|
return array.slice(index + 1);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { identity } from "../../function/identity.mjs";
|
|
2
2
|
import { negate } from "../../function/negate.mjs";
|
|
3
3
|
import { toArray } from "../_internal/toArray.mjs";
|
|
4
|
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
|
4
5
|
import { iteratee } from "../util/iteratee.mjs";
|
|
5
|
-
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
6
6
|
//#region src/compat/array/takeRightWhile.ts
|
|
7
7
|
/**
|
|
8
8
|
* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied.
|
|
@@ -50,7 +50,7 @@ import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
|
50
50
|
* console.log(result6); // []
|
|
51
51
|
*/
|
|
52
52
|
function takeRightWhile(_array, predicate) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!isArrayLike(_array)) return [];
|
|
54
54
|
const array = toArray(_array);
|
|
55
55
|
const index = array.findLastIndex(negate(iteratee(predicate ?? identity)));
|
|
56
56
|
return array.slice(index + 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_toArray = require("../_internal/toArray.js");
|
|
2
|
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
|
2
3
|
const require_iteratee = require("../util/iteratee.js");
|
|
3
|
-
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
4
4
|
const require_identity = require("../function/identity.js");
|
|
5
5
|
const require_negate = require("../function/negate.js");
|
|
6
6
|
//#region src/compat/array/takeWhile.ts
|
|
@@ -50,7 +50,7 @@ const require_negate = require("../function/negate.js");
|
|
|
50
50
|
* console.log(result6); // []
|
|
51
51
|
**/
|
|
52
52
|
function takeWhile(array, predicate) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!require_isArrayLike.isArrayLike(array)) return [];
|
|
54
54
|
const _array = require_toArray.toArray(array);
|
|
55
55
|
const index = _array.findIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity)));
|
|
56
56
|
return index === -1 ? _array : _array.slice(0, index);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toArray } from "../_internal/toArray.mjs";
|
|
2
|
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
|
2
3
|
import { iteratee } from "../util/iteratee.mjs";
|
|
3
|
-
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
4
4
|
import { identity } from "../function/identity.mjs";
|
|
5
5
|
import { negate } from "../function/negate.mjs";
|
|
6
6
|
//#region src/compat/array/takeWhile.ts
|
|
@@ -50,7 +50,7 @@ import { negate } from "../function/negate.mjs";
|
|
|
50
50
|
* console.log(result6); // []
|
|
51
51
|
**/
|
|
52
52
|
function takeWhile(array, predicate) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!isArrayLike(array)) return [];
|
|
54
54
|
const _array = toArray(array);
|
|
55
55
|
const index = _array.findIndex(negate(iteratee(predicate ?? identity)));
|
|
56
56
|
return index === -1 ? _array : _array.slice(0, index);
|
|
@@ -3,6 +3,7 @@ const require_uniq = require("../../array/uniq.js");
|
|
|
3
3
|
const require_uniqBy = require("../../array/uniqBy.js");
|
|
4
4
|
const require_ary = require("../../function/ary.js");
|
|
5
5
|
const require_iteratee = require("../util/iteratee.js");
|
|
6
|
+
const require_normalizeZero = require("../_internal/normalizeZero.js");
|
|
6
7
|
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
7
8
|
const require_flattenArrayLike = require("../_internal/flattenArrayLike.js");
|
|
8
9
|
//#region src/compat/array/unionBy.ts
|
|
@@ -31,7 +32,7 @@ function unionBy(...values) {
|
|
|
31
32
|
const lastValue = require_last.last(values);
|
|
32
33
|
const flattened = require_flattenArrayLike.flattenArrayLike(values);
|
|
33
34
|
if (require_isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) return require_uniq.uniq(flattened);
|
|
34
|
-
return require_uniqBy.uniqBy(flattened, require_ary.ary(require_iteratee.iteratee(lastValue), 1));
|
|
35
|
+
return require_uniqBy.uniqBy(flattened, require_ary.ary(require_iteratee.iteratee(lastValue), 1)).map(require_normalizeZero.normalizeZero);
|
|
35
36
|
}
|
|
36
37
|
//#endregion
|
|
37
38
|
exports.unionBy = unionBy;
|
|
@@ -3,6 +3,7 @@ import { uniq } from "../../array/uniq.mjs";
|
|
|
3
3
|
import { uniqBy } from "../../array/uniqBy.mjs";
|
|
4
4
|
import { ary } from "../../function/ary.mjs";
|
|
5
5
|
import { iteratee } from "../util/iteratee.mjs";
|
|
6
|
+
import { normalizeZero } from "../_internal/normalizeZero.mjs";
|
|
6
7
|
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
7
8
|
import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs";
|
|
8
9
|
//#region src/compat/array/unionBy.ts
|
|
@@ -31,7 +32,7 @@ function unionBy(...values) {
|
|
|
31
32
|
const lastValue = last(values);
|
|
32
33
|
const flattened = flattenArrayLike(values);
|
|
33
34
|
if (isArrayLikeObject(lastValue) || lastValue == null) return uniq(flattened);
|
|
34
|
-
return uniqBy(flattened, ary(iteratee(lastValue), 1));
|
|
35
|
+
return uniqBy(flattened, ary(iteratee(lastValue), 1)).map(normalizeZero);
|
|
35
36
|
}
|
|
36
37
|
//#endregion
|
|
37
38
|
export { unionBy };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const require_uniqBy = require("../../array/uniqBy.js");
|
|
2
2
|
const require_ary = require("../../function/ary.js");
|
|
3
3
|
const require_identity = require("../../function/identity.js");
|
|
4
|
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
|
4
5
|
const require_iteratee = require("../util/iteratee.js");
|
|
5
|
-
const
|
|
6
|
+
const require_normalizeZero = require("../_internal/normalizeZero.js");
|
|
6
7
|
//#region src/compat/array/uniqBy.ts
|
|
7
8
|
function uniqBy(array, iteratee$1 = require_identity.identity) {
|
|
8
|
-
if (!
|
|
9
|
-
return require_uniqBy.uniqBy(Array.from(array), require_ary.ary(require_iteratee.iteratee(iteratee$1), 1));
|
|
9
|
+
if (!require_isArrayLike.isArrayLike(array)) return [];
|
|
10
|
+
return require_uniqBy.uniqBy(Array.from(array), require_ary.ary(require_iteratee.iteratee(iteratee$1), 1)).map(require_normalizeZero.normalizeZero);
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
13
|
exports.uniqBy = uniqBy;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { uniqBy as uniqBy$1 } from "../../array/uniqBy.mjs";
|
|
2
2
|
import { ary } from "../../function/ary.mjs";
|
|
3
3
|
import { identity } from "../../function/identity.mjs";
|
|
4
|
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
|
4
5
|
import { iteratee } from "../util/iteratee.mjs";
|
|
5
|
-
import {
|
|
6
|
+
import { normalizeZero } from "../_internal/normalizeZero.mjs";
|
|
6
7
|
//#region src/compat/array/uniqBy.ts
|
|
7
8
|
function uniqBy(array, iteratee$1 = identity) {
|
|
8
|
-
if (!
|
|
9
|
-
return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1));
|
|
9
|
+
if (!isArrayLike(array)) return [];
|
|
10
|
+
return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1)).map(normalizeZero);
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
13
|
export { uniqBy };
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Gathers elements in the same position in an internal array
|
|
4
4
|
* from a grouped array of elements and returns them as a new array.
|
|
5
5
|
*
|
|
6
|
+
* The returned array's length matches the longest nested array.
|
|
7
|
+
* Missing positions in shorter arrays are filled with `undefined`.
|
|
8
|
+
*
|
|
6
9
|
* @template T - The type of elements in the nested array.
|
|
7
10
|
* @param array - The nested array to unzip.
|
|
8
11
|
* @returns A new array of unzipped elements.
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Gathers elements in the same position in an internal array
|
|
4
4
|
* from a grouped array of elements and returns them as a new array.
|
|
5
5
|
*
|
|
6
|
+
* The returned array's length matches the longest nested array.
|
|
7
|
+
* Missing positions in shorter arrays are filled with `undefined`.
|
|
8
|
+
*
|
|
6
9
|
* @template T - The type of elements in the nested array.
|
|
7
10
|
* @param array - The nested array to unzip.
|
|
8
11
|
* @returns A new array of unzipped elements.
|
|
@@ -6,6 +6,9 @@ const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
|
6
6
|
* Gathers elements in the same position in an internal array
|
|
7
7
|
* from a grouped array of elements and returns them as a new array.
|
|
8
8
|
*
|
|
9
|
+
* The returned array's length matches the longest nested array.
|
|
10
|
+
* Missing positions in shorter arrays are filled with `undefined`.
|
|
11
|
+
*
|
|
9
12
|
* @template T - The type of elements in the nested array.
|
|
10
13
|
* @param array - The nested array to unzip.
|
|
11
14
|
* @returns A new array of unzipped elements.
|
|
@@ -6,6 +6,9 @@ import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
|
6
6
|
* Gathers elements in the same position in an internal array
|
|
7
7
|
* from a grouped array of elements and returns them as a new array.
|
|
8
8
|
*
|
|
9
|
+
* The returned array's length matches the longest nested array.
|
|
10
|
+
* Missing positions in shorter arrays are filled with `undefined`.
|
|
11
|
+
*
|
|
9
12
|
* @template T - The type of elements in the nested array.
|
|
10
13
|
* @param array - The nested array to unzip.
|
|
11
14
|
* @returns A new array of unzipped elements.
|
|
@@ -15,7 +15,7 @@ const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
18
|
-
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
18
|
+
* const result = unzipWith(nestedArray, (a, b, c) => a + b + c);
|
|
19
19
|
* console.log(result); // [9, 12]
|
|
20
20
|
*/
|
|
21
21
|
function unzipWith(array, iteratee) {
|
|
@@ -15,7 +15,7 @@ import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
18
|
-
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
18
|
+
* const result = unzipWith(nestedArray, (a, b, c) => a + b + c);
|
|
19
19
|
* console.log(result); // [9, 12]
|
|
20
20
|
*/
|
|
21
21
|
function unzipWith(array, iteratee) {
|
|
@@ -31,6 +31,8 @@ const require_assignValue = require("../_internal/assignValue.js");
|
|
|
31
31
|
* // result2 will be { a: 1, b: 2 }
|
|
32
32
|
*/
|
|
33
33
|
function zipObject(keys = [], values = []) {
|
|
34
|
+
keys = keys || [];
|
|
35
|
+
values = values || [];
|
|
34
36
|
const result = {};
|
|
35
37
|
for (let i = 0; i < keys.length; i++) require_assignValue.assignValue(result, keys[i], values[i]);
|
|
36
38
|
return result;
|
|
@@ -31,6 +31,8 @@ import { assignValue } from "../_internal/assignValue.mjs";
|
|
|
31
31
|
* // result2 will be { a: 1, b: 2 }
|
|
32
32
|
*/
|
|
33
33
|
function zipObject(keys = [], values = []) {
|
|
34
|
+
keys = keys || [];
|
|
35
|
+
values = values || [];
|
|
34
36
|
const result = {};
|
|
35
37
|
for (let i = 0; i < keys.length; i++) assignValue(result, keys[i], values[i]);
|
|
36
38
|
return result;
|
package/dist/compat/compat.d.mts
CHANGED
|
@@ -149,6 +149,8 @@ import { cloneWith } from "./object/cloneWith.mjs";
|
|
|
149
149
|
import { create } from "./object/create.mjs";
|
|
150
150
|
import { defaults } from "./object/defaults.mjs";
|
|
151
151
|
import { defaultsDeep } from "./object/defaultsDeep.mjs";
|
|
152
|
+
import { toPairs } from "./object/toPairs.mjs";
|
|
153
|
+
import { toPairsIn } from "./object/toPairsIn.mjs";
|
|
152
154
|
import { findKey } from "./object/findKey.mjs";
|
|
153
155
|
import { findLastKey } from "./object/findLastKey.mjs";
|
|
154
156
|
import { forIn } from "./object/forIn.mjs";
|
|
@@ -179,8 +181,6 @@ import { result } from "./object/result.mjs";
|
|
|
179
181
|
import { set } from "./object/set.mjs";
|
|
180
182
|
import { setWith } from "./object/setWith.mjs";
|
|
181
183
|
import { toDefaulted } from "./object/toDefaulted.mjs";
|
|
182
|
-
import { toPairs } from "./object/toPairs.mjs";
|
|
183
|
-
import { toPairsIn } from "./object/toPairsIn.mjs";
|
|
184
184
|
import { transform } from "./object/transform.mjs";
|
|
185
185
|
import { unset } from "./object/unset.mjs";
|
|
186
186
|
import { update } from "./object/update.mjs";
|
|
@@ -293,7 +293,7 @@ import { uniqueId } from "./util/uniqueId.mjs";
|
|
|
293
293
|
|
|
294
294
|
//#region src/compat/compat.d.ts
|
|
295
295
|
declare namespace compat_d_exports {
|
|
296
|
-
export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith };
|
|
296
|
+
export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, toPairs as entries, toPairsIn as entriesIn, eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith };
|
|
297
297
|
}
|
|
298
298
|
//#endregion
|
|
299
299
|
export { compat_d_exports };
|
package/dist/compat/compat.d.ts
CHANGED
|
@@ -149,6 +149,8 @@ import { cloneWith } from "./object/cloneWith.js";
|
|
|
149
149
|
import { create } from "./object/create.js";
|
|
150
150
|
import { defaults } from "./object/defaults.js";
|
|
151
151
|
import { defaultsDeep } from "./object/defaultsDeep.js";
|
|
152
|
+
import { toPairs } from "./object/toPairs.js";
|
|
153
|
+
import { toPairsIn } from "./object/toPairsIn.js";
|
|
152
154
|
import { findKey } from "./object/findKey.js";
|
|
153
155
|
import { findLastKey } from "./object/findLastKey.js";
|
|
154
156
|
import { forIn } from "./object/forIn.js";
|
|
@@ -179,8 +181,6 @@ import { result } from "./object/result.js";
|
|
|
179
181
|
import { set } from "./object/set.js";
|
|
180
182
|
import { setWith } from "./object/setWith.js";
|
|
181
183
|
import { toDefaulted } from "./object/toDefaulted.js";
|
|
182
|
-
import { toPairs } from "./object/toPairs.js";
|
|
183
|
-
import { toPairsIn } from "./object/toPairsIn.js";
|
|
184
184
|
import { transform } from "./object/transform.js";
|
|
185
185
|
import { unset } from "./object/unset.js";
|
|
186
186
|
import { update } from "./object/update.js";
|
|
@@ -293,7 +293,7 @@ import { uniqueId } from "./util/uniqueId.js";
|
|
|
293
293
|
|
|
294
294
|
//#region src/compat/compat.d.ts
|
|
295
295
|
declare namespace compat_d_exports {
|
|
296
|
-
export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith };
|
|
296
|
+
export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, toPairs as entries, toPairsIn as entriesIn, eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith };
|
|
297
297
|
}
|
|
298
298
|
//#endregion
|
|
299
299
|
export { compat_d_exports };
|
package/dist/compat/compat.js
CHANGED
|
@@ -54,8 +54,8 @@ const require_head = require("./array/head.js");
|
|
|
54
54
|
require("./array/first.js");
|
|
55
55
|
const require_flattenDepth = require("./array/flattenDepth.js");
|
|
56
56
|
const require_map = require("./array/map.js");
|
|
57
|
-
const require_flatMap = require("./array/flatMap.js");
|
|
58
57
|
const require_flatMapDepth = require("./array/flatMapDepth.js");
|
|
58
|
+
const require_flatMap = require("./array/flatMap.js");
|
|
59
59
|
const require_flatMapDeep = require("./array/flatMapDeep.js");
|
|
60
60
|
const require_flatten = require("./array/flatten.js");
|
|
61
61
|
const require_flattenDeep = require("./array/flattenDeep.js");
|
|
@@ -65,7 +65,6 @@ const require_indexOf = require("./array/indexOf.js");
|
|
|
65
65
|
const require_initial = require("./array/initial.js");
|
|
66
66
|
const require_intersection = require("./array/intersection.js");
|
|
67
67
|
const require_intersectionBy = require("./array/intersectionBy.js");
|
|
68
|
-
const require_uniq = require("./array/uniq.js");
|
|
69
68
|
const require_intersectionWith = require("./array/intersectionWith.js");
|
|
70
69
|
const require_invokeMap = require("./array/invokeMap.js");
|
|
71
70
|
const require_join = require("./array/join.js");
|
|
@@ -119,6 +118,7 @@ const require_takeWhile = require("./array/takeWhile.js");
|
|
|
119
118
|
const require_union = require("./array/union.js");
|
|
120
119
|
const require_unionBy = require("./array/unionBy.js");
|
|
121
120
|
const require_unionWith = require("./array/unionWith.js");
|
|
121
|
+
const require_uniq = require("./array/uniq.js");
|
|
122
122
|
const require_uniqBy = require("./array/uniqBy.js");
|
|
123
123
|
const require_uniqWith = require("./array/uniqWith.js");
|
|
124
124
|
const require_unzip = require("./array/unzip.js");
|
|
@@ -190,6 +190,10 @@ const require_cloneWith = require("./object/cloneWith.js");
|
|
|
190
190
|
const require_create = require("./object/create.js");
|
|
191
191
|
const require_defaults = require("./object/defaults.js");
|
|
192
192
|
const require_defaultsDeep = require("./object/defaultsDeep.js");
|
|
193
|
+
const require_toPairs = require("./object/toPairs.js");
|
|
194
|
+
require("./object/entries.js");
|
|
195
|
+
const require_toPairsIn = require("./object/toPairsIn.js");
|
|
196
|
+
require("./object/entriesIn.js");
|
|
193
197
|
require("./object/extend.js");
|
|
194
198
|
require("./object/extendWith.js");
|
|
195
199
|
const require_findKey = require("./object/findKey.js");
|
|
@@ -216,8 +220,6 @@ const require_propertyOf = require("./object/propertyOf.js");
|
|
|
216
220
|
const require_result = require("./object/result.js");
|
|
217
221
|
const require_setWith = require("./object/setWith.js");
|
|
218
222
|
const require_toDefaulted = require("./object/toDefaulted.js");
|
|
219
|
-
const require_toPairs = require("./object/toPairs.js");
|
|
220
|
-
const require_toPairsIn = require("./object/toPairsIn.js");
|
|
221
223
|
const require_isBuffer = require("./predicate/isBuffer.js");
|
|
222
224
|
const require_transform = require("./object/transform.js");
|
|
223
225
|
const require_update = require("./object/update.js");
|
|
@@ -349,6 +351,8 @@ var compat_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
349
351
|
each: () => require_forEach.forEach,
|
|
350
352
|
eachRight: () => require_forEachRight.forEachRight,
|
|
351
353
|
endsWith: () => require_endsWith.endsWith,
|
|
354
|
+
entries: () => require_toPairs.toPairs,
|
|
355
|
+
entriesIn: () => require_toPairsIn.toPairsIn,
|
|
352
356
|
eq: () => require_eq.eq,
|
|
353
357
|
escape: () => require_escape.escape,
|
|
354
358
|
escapeRegExp: () => require_escapeRegExp.escapeRegExp,
|
package/dist/compat/compat.mjs
CHANGED
|
@@ -54,8 +54,8 @@ import { head } from "./array/head.mjs";
|
|
|
54
54
|
import "./array/first.mjs";
|
|
55
55
|
import { flattenDepth } from "./array/flattenDepth.mjs";
|
|
56
56
|
import { map } from "./array/map.mjs";
|
|
57
|
-
import { flatMap } from "./array/flatMap.mjs";
|
|
58
57
|
import { flatMapDepth } from "./array/flatMapDepth.mjs";
|
|
58
|
+
import { flatMap } from "./array/flatMap.mjs";
|
|
59
59
|
import { flatMapDeep } from "./array/flatMapDeep.mjs";
|
|
60
60
|
import { flatten } from "./array/flatten.mjs";
|
|
61
61
|
import { flattenDeep } from "./array/flattenDeep.mjs";
|
|
@@ -65,7 +65,6 @@ import { indexOf } from "./array/indexOf.mjs";
|
|
|
65
65
|
import { initial } from "./array/initial.mjs";
|
|
66
66
|
import { intersection } from "./array/intersection.mjs";
|
|
67
67
|
import { intersectionBy } from "./array/intersectionBy.mjs";
|
|
68
|
-
import { uniq } from "./array/uniq.mjs";
|
|
69
68
|
import { intersectionWith } from "./array/intersectionWith.mjs";
|
|
70
69
|
import { invokeMap } from "./array/invokeMap.mjs";
|
|
71
70
|
import { join } from "./array/join.mjs";
|
|
@@ -119,6 +118,7 @@ import { takeWhile } from "./array/takeWhile.mjs";
|
|
|
119
118
|
import { union } from "./array/union.mjs";
|
|
120
119
|
import { unionBy } from "./array/unionBy.mjs";
|
|
121
120
|
import { unionWith } from "./array/unionWith.mjs";
|
|
121
|
+
import { uniq } from "./array/uniq.mjs";
|
|
122
122
|
import { uniqBy } from "./array/uniqBy.mjs";
|
|
123
123
|
import { uniqWith } from "./array/uniqWith.mjs";
|
|
124
124
|
import { unzip } from "./array/unzip.mjs";
|
|
@@ -190,6 +190,10 @@ import { cloneWith } from "./object/cloneWith.mjs";
|
|
|
190
190
|
import { create } from "./object/create.mjs";
|
|
191
191
|
import { defaults } from "./object/defaults.mjs";
|
|
192
192
|
import { defaultsDeep } from "./object/defaultsDeep.mjs";
|
|
193
|
+
import { toPairs } from "./object/toPairs.mjs";
|
|
194
|
+
import "./object/entries.mjs";
|
|
195
|
+
import { toPairsIn } from "./object/toPairsIn.mjs";
|
|
196
|
+
import "./object/entriesIn.mjs";
|
|
193
197
|
import "./object/extend.mjs";
|
|
194
198
|
import "./object/extendWith.mjs";
|
|
195
199
|
import { findKey } from "./object/findKey.mjs";
|
|
@@ -216,8 +220,6 @@ import { propertyOf } from "./object/propertyOf.mjs";
|
|
|
216
220
|
import { result } from "./object/result.mjs";
|
|
217
221
|
import { setWith } from "./object/setWith.mjs";
|
|
218
222
|
import { toDefaulted } from "./object/toDefaulted.mjs";
|
|
219
|
-
import { toPairs } from "./object/toPairs.mjs";
|
|
220
|
-
import { toPairsIn } from "./object/toPairsIn.mjs";
|
|
221
223
|
import { isBuffer } from "./predicate/isBuffer.mjs";
|
|
222
224
|
import { transform } from "./object/transform.mjs";
|
|
223
225
|
import { update } from "./object/update.mjs";
|
|
@@ -349,6 +351,8 @@ var compat_exports = /* @__PURE__ */ __exportAll({
|
|
|
349
351
|
each: () => forEach,
|
|
350
352
|
eachRight: () => forEachRight,
|
|
351
353
|
endsWith: () => endsWith,
|
|
354
|
+
entries: () => toPairs,
|
|
355
|
+
entriesIn: () => toPairsIn,
|
|
352
356
|
eq: () => eq,
|
|
353
357
|
escape: () => escape,
|
|
354
358
|
escapeRegExp: () => escapeRegExp,
|
|
@@ -140,7 +140,7 @@ declare function curry<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4:
|
|
|
140
140
|
* @param arity - The arity of func.
|
|
141
141
|
* @returns Returns the new curried function.
|
|
142
142
|
* @example
|
|
143
|
-
* const sum = (
|
|
143
|
+
* const sum = (a: number, b: number, c: number) => a + b + c;
|
|
144
144
|
* const curriedSum = curry(sum);
|
|
145
145
|
* curriedSum(1, 2, 3); // => 6
|
|
146
146
|
* curriedSum(1)(2, 3); // => 6
|
|
@@ -140,7 +140,7 @@ declare function curry<T1, T2, T3, T4, T5, R>(func: (t1: T1, t2: T2, t3: T3, t4:
|
|
|
140
140
|
* @param arity - The arity of func.
|
|
141
141
|
* @returns Returns the new curried function.
|
|
142
142
|
* @example
|
|
143
|
-
* const sum = (
|
|
143
|
+
* const sum = (a: number, b: number, c: number) => a + b + c;
|
|
144
144
|
* const curriedSum = curry(sum);
|
|
145
145
|
* curriedSum(1, 2, 3); // => 6
|
|
146
146
|
* curriedSum(1)(2, 3); // => 6
|
|
@@ -38,7 +38,7 @@ declare function flowRight<A extends any[], R1, R2, R3, R4, R5, R6, R7>(f7: (a:
|
|
|
38
38
|
* const length = (s: string) => s.length;
|
|
39
39
|
*
|
|
40
40
|
* const combined = flowRight(length, append, toString, double, square, add);
|
|
41
|
-
* console.log(combined(1, 2)); //
|
|
41
|
+
* console.log(combined(1, 2)); // 3
|
|
42
42
|
*/
|
|
43
43
|
declare function flowRight<A extends any[], R1, R2, R3, R4, R5, R6>(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6;
|
|
44
44
|
/**
|
|
@@ -38,7 +38,7 @@ declare function flowRight<A extends any[], R1, R2, R3, R4, R5, R6, R7>(f7: (a:
|
|
|
38
38
|
* const length = (s: string) => s.length;
|
|
39
39
|
*
|
|
40
40
|
* const combined = flowRight(length, append, toString, double, square, add);
|
|
41
|
-
* console.log(combined(1, 2)); //
|
|
41
|
+
* console.log(combined(1, 2)); // 3
|
|
42
42
|
*/
|
|
43
43
|
declare function flowRight<A extends any[], R1, R2, R3, R4, R5, R6>(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6;
|
|
44
44
|
/**
|
|
@@ -161,7 +161,7 @@ declare function partial<TS extends any[], R>(func: (...ts: TS) => R): (...ts: T
|
|
|
161
161
|
* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
|
|
162
162
|
*
|
|
163
163
|
* @example
|
|
164
|
-
* const log = (prefix: string, ...messages: string[]) =>
|
|
164
|
+
* const log = (prefix: string, ...messages: string[]) => [prefix, ...messages].join(' ');
|
|
165
165
|
* const debugLog = partial(log, '[DEBUG]');
|
|
166
166
|
* debugLog('message 1', 'message 2'); // => '[DEBUG] message 1 message 2'
|
|
167
167
|
*/
|
|
@@ -161,7 +161,7 @@ declare function partial<TS extends any[], R>(func: (...ts: TS) => R): (...ts: T
|
|
|
161
161
|
* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
|
|
162
162
|
*
|
|
163
163
|
* @example
|
|
164
|
-
* const log = (prefix: string, ...messages: string[]) =>
|
|
164
|
+
* const log = (prefix: string, ...messages: string[]) => [prefix, ...messages].join(' ');
|
|
165
165
|
* const debugLog = partial(log, '[DEBUG]');
|
|
166
166
|
* debugLog('message 1', 'message 2'); // => '[DEBUG] message 1 message 2'
|
|
167
167
|
*/
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* // Using start index 1
|
|
25
25
|
* const transformedFnWithStart = rest(fn, 1);
|
|
26
|
-
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]]
|
|
26
|
+
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4], undefined]
|
|
27
27
|
*
|
|
28
28
|
* // With fewer arguments than the start index
|
|
29
29
|
* console.log(transformedFn(1)); // [1, undefined, []]
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* // Using start index 1
|
|
25
25
|
* const transformedFnWithStart = rest(fn, 1);
|
|
26
|
-
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]]
|
|
26
|
+
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4], undefined]
|
|
27
27
|
*
|
|
28
28
|
* // With fewer arguments than the start index
|
|
29
29
|
* console.log(transformedFn(1)); // [1, undefined, []]
|
|
@@ -24,7 +24,7 @@ const require_rest = require("../../function/rest.js");
|
|
|
24
24
|
*
|
|
25
25
|
* // Using start index 1
|
|
26
26
|
* const transformedFnWithStart = rest(fn, 1);
|
|
27
|
-
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]]
|
|
27
|
+
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4], undefined]
|
|
28
28
|
*
|
|
29
29
|
* // With fewer arguments than the start index
|
|
30
30
|
* console.log(transformedFn(1)); // [1, undefined, []]
|
|
@@ -24,7 +24,7 @@ import { rest as rest$1 } from "../../function/rest.mjs";
|
|
|
24
24
|
*
|
|
25
25
|
* // Using start index 1
|
|
26
26
|
* const transformedFnWithStart = rest(fn, 1);
|
|
27
|
-
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]]
|
|
27
|
+
* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4], undefined]
|
|
28
28
|
*
|
|
29
29
|
* // With fewer arguments than the start index
|
|
30
30
|
* console.log(transformedFn(1)); // [1, undefined, []]
|