es-toolkit 1.13.1 → 1.14.0-dev.397
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 +9 -1
- package/dist/_chunk/index-CwRt_M.js +46 -0
- package/dist/_chunk/initial-BTrQy1.js +514 -0
- package/dist/_chunk/isFunction-Cw_tLG.js +246 -0
- package/dist/_chunk/isTypedArray-BBEkFl.js +43 -0
- package/dist/_chunk/randomInt-CF7bZK.js +19 -0
- package/dist/array/chunk.mjs +15 -8
- package/dist/array/compact.d.mts +1 -1
- package/dist/array/compact.d.ts +1 -1
- package/dist/array/compact.mjs +11 -8
- package/dist/array/countBy.mjs +10 -8
- package/dist/array/difference.mjs +6 -8
- package/dist/array/differenceBy.mjs +8 -8
- package/dist/array/differenceWith.mjs +9 -8
- package/dist/array/drop.mjs +6 -8
- package/dist/array/dropRight.mjs +9 -8
- package/dist/array/dropRightWhile.mjs +10 -8
- package/dist/array/dropWhile.mjs +9 -8
- package/dist/array/fill.d.mts +1 -0
- package/dist/array/fill.d.ts +1 -0
- package/dist/array/fill.mjs +11 -8
- package/dist/array/flatMap.mjs +7 -9
- package/dist/array/flatten.mjs +18 -8
- package/dist/array/flattenDeep.mjs +7 -9
- package/dist/array/forEachRight.mjs +8 -8
- package/dist/array/groupBy.mjs +13 -8
- package/dist/array/head.d.mts +1 -0
- package/dist/array/head.d.ts +1 -0
- package/dist/array/head.mjs +5 -8
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +58 -652
- package/dist/array/index.mjs +52 -211
- package/dist/array/initial.mjs +8 -8
- package/dist/array/intersection.mjs +8 -8
- package/dist/array/intersectionBy.mjs +6 -8
- package/dist/array/intersectionWith.mjs +9 -8
- package/dist/array/isSubset.d.mts +26 -0
- package/dist/array/isSubset.d.ts +26 -0
- package/dist/array/isSubset.mjs +7 -0
- package/dist/array/keyBy.mjs +10 -8
- package/dist/array/last.d.mts +1 -0
- package/dist/array/last.d.ts +1 -0
- package/dist/array/last.mjs +5 -8
- package/dist/array/maxBy.mjs +14 -8
- package/dist/array/minBy.mjs +14 -8
- package/dist/array/orderBy.mjs +25 -8
- package/dist/array/partition.mjs +15 -8
- package/dist/array/sample.mjs +6 -8
- package/dist/array/sampleSize.mjs +20 -10
- package/dist/array/shuffle.mjs +10 -8
- package/dist/array/tail.d.mts +9 -4
- package/dist/array/tail.d.ts +9 -4
- package/dist/array/tail.mjs +13 -8
- package/dist/array/take.mjs +5 -8
- package/dist/array/takeRight.d.mts +2 -2
- package/dist/array/takeRight.d.ts +2 -2
- package/dist/array/takeRight.mjs +8 -8
- package/dist/array/takeRightWhile.mjs +10 -8
- package/dist/array/takeWhile.mjs +12 -8
- package/dist/array/toFilled.d.mts +5 -3
- package/dist/array/toFilled.d.ts +5 -3
- package/dist/array/toFilled.mjs +12 -8
- package/dist/array/union.mjs +7 -9
- package/dist/array/unionBy.mjs +12 -8
- package/dist/array/unionWith.mjs +7 -9
- package/dist/array/uniq.mjs +5 -8
- package/dist/array/uniqBy.mjs +12 -8
- package/dist/array/uniqWith.mjs +12 -8
- package/dist/array/unzip.d.mts +3 -2
- package/dist/array/unzip.d.ts +3 -2
- package/dist/array/unzip.mjs +18 -8
- package/dist/array/unzipWith.mjs +14 -8
- package/dist/array/without.mjs +6 -8
- package/dist/array/xor.mjs +9 -12
- package/dist/array/xorBy.mjs +11 -11
- package/dist/array/xorWith.mjs +11 -12
- package/dist/array/zip.d.mts +1 -0
- package/dist/array/zip.d.ts +1 -0
- package/dist/array/zip.mjs +14 -8
- package/dist/array/zipObject.d.mts +1 -1
- package/dist/array/zipObject.d.ts +1 -1
- package/dist/array/zipObject.mjs +9 -8
- package/dist/array/zipWith.d.mts +5 -0
- package/dist/array/zipWith.d.ts +5 -0
- package/dist/array/zipWith.mjs +13 -8
- package/dist/browser.global.js +2 -0
- package/dist/browser.global.js.map +1 -0
- package/dist/compat/_internal/getSymbols.mjs +6 -0
- package/dist/compat/_internal/getTag.mjs +8 -0
- package/dist/compat/_internal/identity.mjs +5 -0
- package/dist/compat/_internal/isArrayMatch.mjs +24 -0
- package/dist/compat/_internal/isDeepKey.mjs +15 -0
- package/dist/compat/_internal/isIndex.mjs +16 -0
- package/dist/compat/_internal/isMapMatch.mjs +18 -0
- package/dist/compat/_internal/isSetMatch.mjs +13 -0
- package/dist/compat/_internal/tags.mjs +28 -0
- package/dist/compat/_internal/toPath.mjs +40 -0
- package/dist/compat/array/chunk.d.mts +26 -0
- package/dist/compat/array/chunk.d.ts +26 -0
- package/dist/compat/array/chunk.mjs +11 -0
- package/dist/compat/array/concat.d.mts +30 -0
- package/dist/compat/array/concat.d.ts +30 -0
- package/dist/compat/array/concat.mjs +7 -0
- package/dist/compat/array/difference.d.mts +3 -0
- package/dist/compat/array/difference.d.ts +3 -0
- package/dist/compat/array/difference.mjs +10 -0
- package/dist/compat/array/fill.d.mts +33 -0
- package/dist/compat/array/fill.d.ts +33 -0
- package/dist/compat/array/fill.mjs +15 -0
- package/dist/compat/array/flatten.d.mts +19 -0
- package/dist/compat/array/flatten.d.ts +19 -0
- package/dist/compat/array/flatten.mjs +29 -0
- package/dist/compat/array/flattenDeep.d.mts +25 -0
- package/dist/compat/array/flattenDeep.d.ts +25 -0
- package/dist/compat/array/flattenDeep.mjs +7 -0
- package/dist/compat/array/flattenDepth.d.mts +19 -0
- package/dist/compat/array/flattenDepth.d.ts +19 -0
- package/dist/compat/array/flattenDepth.mjs +7 -0
- package/dist/compat/array/size.d.mts +39 -0
- package/dist/compat/array/size.d.ts +39 -0
- package/dist/compat/array/size.mjs +13 -0
- package/dist/compat/array/zipObjectDeep.d.mts +37 -0
- package/dist/compat/array/zipObjectDeep.d.ts +37 -0
- package/dist/compat/array/zipObjectDeep.mjs +16 -0
- package/dist/compat/function/ary.d.mts +11 -0
- package/dist/compat/function/ary.d.ts +11 -0
- package/dist/compat/function/ary.mjs +13 -0
- package/dist/compat/function/bind.d.mts +32 -0
- package/dist/compat/function/bind.d.ts +32 -0
- package/dist/compat/function/bind.mjs +27 -0
- package/dist/compat/index.d.mts +37 -472
- package/dist/compat/index.d.ts +37 -472
- package/dist/compat/index.js +513 -1333
- package/dist/compat/index.mjs +121 -391
- package/dist/compat/math/max.d.mts +19 -0
- package/dist/compat/math/max.d.ts +19 -0
- package/dist/compat/math/max.mjs +13 -0
- package/dist/compat/math/min.d.mts +19 -0
- package/dist/compat/math/min.d.ts +19 -0
- package/dist/compat/math/min.mjs +13 -0
- package/dist/compat/object/get.d.mts +247 -0
- package/dist/compat/object/get.d.ts +247 -0
- package/dist/compat/object/get.mjs +33 -0
- package/dist/compat/object/get.types.d.mts +9 -0
- package/dist/compat/object/get.types.d.ts +9 -0
- package/dist/compat/object/mapKeys.d.mts +39 -0
- package/dist/compat/object/mapKeys.d.ts +39 -0
- package/dist/compat/object/mapKeys.mjs +20 -0
- package/dist/compat/object/mapValues.d.mts +40 -0
- package/dist/compat/object/mapValues.d.ts +40 -0
- package/dist/compat/object/mapValues.mjs +20 -0
- package/dist/compat/object/property.d.mts +19 -0
- package/dist/compat/object/property.d.ts +19 -0
- package/dist/compat/object/property.mjs +9 -0
- package/dist/compat/object/set.d.mts +30 -0
- package/dist/compat/object/set.d.ts +30 -0
- package/dist/compat/object/set.mjs +24 -0
- package/dist/compat/predicate/isArguments.d.mts +23 -0
- package/dist/compat/predicate/isArguments.d.ts +23 -0
- package/dist/compat/predicate/isArguments.mjs +7 -0
- package/dist/compat/predicate/isArray.d.mts +23 -0
- package/dist/compat/predicate/isArray.d.ts +23 -0
- package/dist/compat/predicate/isArray.mjs +5 -0
- package/dist/compat/predicate/isArrayLike.d.mts +17 -0
- package/dist/compat/predicate/isArrayLike.d.ts +17 -0
- package/dist/compat/predicate/isArrayLike.mjs +8 -0
- package/dist/compat/predicate/isBoolean.d.mts +25 -0
- package/dist/compat/predicate/isBoolean.d.ts +25 -0
- package/dist/compat/predicate/isBoolean.mjs +13 -0
- package/dist/compat/predicate/isMatch.d.mts +31 -0
- package/dist/compat/predicate/isMatch.d.ts +31 -0
- package/dist/compat/predicate/isMatch.mjs +57 -0
- package/dist/compat/predicate/isObjectLike.d.mts +26 -0
- package/dist/compat/predicate/isObjectLike.d.ts +26 -0
- package/dist/compat/predicate/isObjectLike.mjs +5 -0
- package/dist/compat/predicate/isPlainObject.d.mts +25 -0
- package/dist/compat/predicate/isPlainObject.d.ts +25 -0
- package/dist/compat/predicate/isPlainObject.mjs +29 -0
- package/dist/compat/predicate/isTypedArray.d.mts +19 -0
- package/dist/compat/predicate/isTypedArray.d.ts +19 -0
- package/dist/compat/predicate/isTypedArray.mjs +7 -0
- package/dist/compat/predicate/matches.d.mts +27 -0
- package/dist/compat/predicate/matches.d.ts +27 -0
- package/dist/compat/predicate/matches.mjs +11 -0
- package/dist/compat/string/endsWith.d.mts +20 -0
- package/dist/compat/string/endsWith.d.ts +20 -0
- package/dist/compat/string/endsWith.mjs +5 -0
- package/dist/compat/string/padStart.d.mts +20 -0
- package/dist/compat/string/padStart.d.ts +20 -0
- package/dist/compat/string/padStart.mjs +5 -0
- package/dist/compat/string/startsWith.d.mts +20 -0
- package/dist/compat/string/startsWith.d.ts +20 -0
- package/dist/compat/string/startsWith.mjs +5 -0
- package/dist/error/AbortError.mjs +8 -8
- package/dist/error/TimeoutError.mjs +8 -8
- package/dist/function/after.d.mts +31 -0
- package/dist/function/after.d.ts +31 -0
- package/dist/function/after.mjs +14 -0
- package/dist/function/ary.d.mts +12 -0
- package/dist/function/ary.d.ts +12 -0
- package/dist/function/ary.mjs +7 -0
- package/dist/function/before.d.mts +31 -0
- package/dist/function/before.d.ts +31 -0
- package/dist/function/before.mjs +14 -0
- package/dist/function/debounce.mjs +28 -8
- package/dist/function/index.d.mts +4 -0
- package/dist/function/index.d.ts +4 -0
- package/dist/function/index.js +93 -88
- package/dist/function/index.mjs +9 -25
- package/dist/function/negate.mjs +5 -8
- package/dist/function/noop.mjs +3 -8
- package/dist/function/once.mjs +15 -8
- package/dist/function/throttle.mjs +13 -8
- package/dist/function/unary.d.mts +10 -0
- package/dist/function/unary.d.ts +10 -0
- package/dist/function/unary.mjs +7 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +120 -1210
- package/dist/index.mjs +102 -375
- package/dist/math/clamp.mjs +8 -8
- package/dist/math/inRange.mjs +12 -8
- package/dist/math/index.js +58 -115
- package/dist/math/index.mjs +10 -45
- package/dist/math/mean.mjs +7 -9
- package/dist/math/meanBy.mjs +8 -10
- package/dist/math/random.mjs +12 -8
- package/dist/math/randomInt.mjs +7 -9
- package/dist/math/range.mjs +20 -8
- package/dist/math/round.mjs +9 -8
- package/dist/math/sum.mjs +9 -8
- package/dist/math/sumBy.mjs +8 -9
- package/dist/object/clone.mjs +39 -8
- package/dist/object/cloneDeep.d.mts +49 -0
- package/dist/object/cloneDeep.d.ts +49 -0
- package/dist/object/cloneDeep.mjs +113 -0
- package/dist/object/flattenObject.mjs +28 -9
- package/dist/object/index.d.mts +3 -0
- package/dist/object/index.d.ts +3 -0
- package/dist/object/index.js +230 -165
- package/dist/object/index.mjs +10 -34
- package/dist/object/invert.mjs +12 -8
- package/dist/object/mapKeys.d.mts +21 -0
- package/dist/object/mapKeys.d.ts +21 -0
- package/dist/object/mapKeys.mjs +12 -0
- package/dist/object/mapValues.d.mts +21 -0
- package/dist/object/mapValues.d.ts +21 -0
- package/dist/object/mapValues.mjs +12 -0
- package/dist/object/omit.mjs +9 -8
- package/dist/object/omitBy.mjs +12 -8
- package/dist/object/pick.mjs +9 -8
- package/dist/object/pickBy.mjs +12 -8
- package/dist/predicate/index.d.mts +4 -0
- package/dist/predicate/index.d.ts +4 -0
- package/dist/predicate/index.js +17 -126
- package/dist/predicate/index.mjs +11 -35
- package/dist/predicate/isBoolean.d.mts +25 -0
- package/dist/predicate/isBoolean.d.ts +25 -0
- package/dist/predicate/isBoolean.mjs +5 -0
- package/dist/predicate/isEqual.d.mts +1 -1
- package/dist/predicate/isEqual.d.ts +1 -1
- package/dist/predicate/isEqual.mjs +177 -10
- package/dist/predicate/isFunction.d.mts +16 -0
- package/dist/predicate/isFunction.d.ts +16 -0
- package/dist/predicate/isFunction.mjs +5 -0
- package/dist/predicate/isLength.d.mts +21 -0
- package/dist/predicate/isLength.d.ts +21 -0
- package/dist/predicate/isLength.mjs +5 -8
- package/dist/predicate/isNil.mjs +5 -8
- package/dist/predicate/isNotNil.mjs +5 -8
- package/dist/predicate/isNull.mjs +5 -8
- package/dist/predicate/isPlainObject.mjs +21 -8
- package/dist/predicate/isPrimitive.d.mts +17 -0
- package/dist/predicate/isPrimitive.d.ts +17 -0
- package/dist/predicate/isPrimitive.mjs +5 -0
- package/dist/predicate/isTypedArray.d.mts +19 -0
- package/dist/predicate/isTypedArray.d.ts +19 -0
- package/dist/predicate/isTypedArray.mjs +15 -0
- package/dist/predicate/isUndefined.mjs +5 -8
- package/dist/promise/delay.mjs +20 -9
- package/dist/promise/index.js +5 -96
- package/dist/promise/index.mjs +2 -16
- package/dist/promise/timeout.mjs +9 -11
- package/dist/promise/withTimeout.mjs +7 -12
- package/dist/string/_internal/getWords.mjs +6 -0
- package/dist/string/camelCase.mjs +13 -10
- package/dist/string/capitalize.mjs +4 -7
- package/dist/string/index.js +41 -78
- package/dist/string/index.mjs +6 -30
- package/dist/string/kebabCase.mjs +7 -8
- package/dist/string/lowerCase.mjs +7 -8
- package/dist/string/snakeCase.mjs +7 -8
- package/dist/string/startCase.mjs +20 -9
- package/package.json +13 -4
- package/dist/array/chunk.js +0 -43
- package/dist/array/chunk.js.map +0 -1
- package/dist/array/chunk.mjs.map +0 -1
- package/dist/array/compact.js +0 -39
- package/dist/array/compact.js.map +0 -1
- package/dist/array/compact.mjs.map +0 -1
- package/dist/array/countBy.js +0 -39
- package/dist/array/countBy.js.map +0 -1
- package/dist/array/countBy.mjs.map +0 -1
- package/dist/array/difference.js +0 -34
- package/dist/array/difference.js.map +0 -1
- package/dist/array/difference.mjs.map +0 -1
- package/dist/array/differenceBy.js +0 -36
- package/dist/array/differenceBy.js.map +0 -1
- package/dist/array/differenceBy.mjs.map +0 -1
- package/dist/array/differenceWith.js +0 -37
- package/dist/array/differenceWith.js.map +0 -1
- package/dist/array/differenceWith.mjs.map +0 -1
- package/dist/array/drop.js +0 -34
- package/dist/array/drop.js.map +0 -1
- package/dist/array/drop.mjs.map +0 -1
- package/dist/array/dropRight.js +0 -37
- package/dist/array/dropRight.js.map +0 -1
- package/dist/array/dropRight.mjs.map +0 -1
- package/dist/array/dropRightWhile.js +0 -38
- package/dist/array/dropRightWhile.js.map +0 -1
- package/dist/array/dropRightWhile.mjs.map +0 -1
- package/dist/array/dropWhile.js +0 -37
- package/dist/array/dropWhile.js.map +0 -1
- package/dist/array/dropWhile.mjs.map +0 -1
- package/dist/array/fill.js +0 -39
- package/dist/array/fill.js.map +0 -1
- package/dist/array/fill.mjs.map +0 -1
- package/dist/array/flatMap.js +0 -52
- package/dist/array/flatMap.js.map +0 -1
- package/dist/array/flatMap.mjs.map +0 -1
- package/dist/array/flatten.js +0 -45
- package/dist/array/flatten.js.map +0 -1
- package/dist/array/flatten.mjs.map +0 -1
- package/dist/array/flattenDeep.js +0 -52
- package/dist/array/flattenDeep.js.map +0 -1
- package/dist/array/flattenDeep.mjs.map +0 -1
- package/dist/array/forEachRight.js +0 -36
- package/dist/array/forEachRight.js.map +0 -1
- package/dist/array/forEachRight.mjs.map +0 -1
- package/dist/array/groupBy.js +0 -41
- package/dist/array/groupBy.js.map +0 -1
- package/dist/array/groupBy.mjs.map +0 -1
- package/dist/array/head.js +0 -33
- package/dist/array/head.js.map +0 -1
- package/dist/array/head.mjs.map +0 -1
- package/dist/array/index.js.map +0 -1
- package/dist/array/index.mjs.map +0 -1
- package/dist/array/initial.js +0 -36
- package/dist/array/initial.js.map +0 -1
- package/dist/array/initial.mjs.map +0 -1
- package/dist/array/intersection.js +0 -36
- package/dist/array/intersection.js.map +0 -1
- package/dist/array/intersection.mjs.map +0 -1
- package/dist/array/intersectionBy.js +0 -34
- package/dist/array/intersectionBy.js.map +0 -1
- package/dist/array/intersectionBy.mjs.map +0 -1
- package/dist/array/intersectionWith.js +0 -37
- package/dist/array/intersectionWith.js.map +0 -1
- package/dist/array/intersectionWith.mjs.map +0 -1
- package/dist/array/keyBy.js +0 -38
- package/dist/array/keyBy.js.map +0 -1
- package/dist/array/keyBy.mjs.map +0 -1
- package/dist/array/last.js +0 -33
- package/dist/array/last.js.map +0 -1
- package/dist/array/last.mjs.map +0 -1
- package/dist/array/maxBy.js +0 -42
- package/dist/array/maxBy.js.map +0 -1
- package/dist/array/maxBy.mjs.map +0 -1
- package/dist/array/minBy.js +0 -42
- package/dist/array/minBy.js.map +0 -1
- package/dist/array/minBy.mjs.map +0 -1
- package/dist/array/orderBy.js +0 -53
- package/dist/array/orderBy.js.map +0 -1
- package/dist/array/orderBy.mjs.map +0 -1
- package/dist/array/partition.js +0 -42
- package/dist/array/partition.js.map +0 -1
- package/dist/array/partition.mjs.map +0 -1
- package/dist/array/sample.js +0 -34
- package/dist/array/sample.js.map +0 -1
- package/dist/array/sample.mjs.map +0 -1
- package/dist/array/sampleSize.js +0 -65
- package/dist/array/sampleSize.js.map +0 -1
- package/dist/array/sampleSize.mjs.map +0 -1
- package/dist/array/shuffle.js +0 -38
- package/dist/array/shuffle.js.map +0 -1
- package/dist/array/shuffle.mjs.map +0 -1
- package/dist/array/tail.js +0 -41
- package/dist/array/tail.js.map +0 -1
- package/dist/array/tail.mjs.map +0 -1
- package/dist/array/take.js +0 -33
- package/dist/array/take.js.map +0 -1
- package/dist/array/take.mjs.map +0 -1
- package/dist/array/takeRight.js +0 -36
- package/dist/array/takeRight.js.map +0 -1
- package/dist/array/takeRight.mjs.map +0 -1
- package/dist/array/takeRightWhile.js +0 -38
- package/dist/array/takeRightWhile.js.map +0 -1
- package/dist/array/takeRightWhile.mjs.map +0 -1
- package/dist/array/takeWhile.js +0 -40
- package/dist/array/takeWhile.js.map +0 -1
- package/dist/array/takeWhile.mjs.map +0 -1
- package/dist/array/toFilled.js +0 -40
- package/dist/array/toFilled.js.map +0 -1
- package/dist/array/toFilled.mjs.map +0 -1
- package/dist/array/union.js +0 -40
- package/dist/array/union.js.map +0 -1
- package/dist/array/union.mjs.map +0 -1
- package/dist/array/unionBy.js +0 -40
- package/dist/array/unionBy.js.map +0 -1
- package/dist/array/unionBy.mjs.map +0 -1
- package/dist/array/unionWith.js +0 -47
- package/dist/array/unionWith.js.map +0 -1
- package/dist/array/unionWith.mjs.map +0 -1
- package/dist/array/uniq.js +0 -33
- package/dist/array/uniq.js.map +0 -1
- package/dist/array/uniq.mjs.map +0 -1
- package/dist/array/uniqBy.js +0 -40
- package/dist/array/uniqBy.js.map +0 -1
- package/dist/array/uniqBy.mjs.map +0 -1
- package/dist/array/uniqWith.js +0 -40
- package/dist/array/uniqWith.js.map +0 -1
- package/dist/array/uniqWith.mjs.map +0 -1
- package/dist/array/unzip.js +0 -46
- package/dist/array/unzip.js.map +0 -1
- package/dist/array/unzip.mjs.map +0 -1
- package/dist/array/unzipWith.js +0 -42
- package/dist/array/unzipWith.js.map +0 -1
- package/dist/array/unzipWith.mjs.map +0 -1
- package/dist/array/without.js +0 -34
- package/dist/array/without.js.map +0 -1
- package/dist/array/without.mjs.map +0 -1
- package/dist/array/xor.js +0 -59
- package/dist/array/xor.js.map +0 -1
- package/dist/array/xor.mjs.map +0 -1
- package/dist/array/xorBy.js +0 -63
- package/dist/array/xorBy.js.map +0 -1
- package/dist/array/xorBy.mjs.map +0 -1
- package/dist/array/xorWith.js +0 -72
- package/dist/array/xorWith.js.map +0 -1
- package/dist/array/xorWith.mjs.map +0 -1
- package/dist/array/zip.js +0 -42
- package/dist/array/zip.js.map +0 -1
- package/dist/array/zip.mjs.map +0 -1
- package/dist/array/zipObject.js +0 -37
- package/dist/array/zipObject.js.map +0 -1
- package/dist/array/zipObject.mjs.map +0 -1
- package/dist/array/zipWith.js +0 -41
- package/dist/array/zipWith.js.map +0 -1
- package/dist/array/zipWith.mjs.map +0 -1
- package/dist/browser.d.mts +0 -2
- package/dist/browser.d.ts +0 -2
- package/dist/browser.js +0 -1325
- package/dist/browser.js.map +0 -1
- package/dist/browser.mjs +0 -109
- package/dist/browser.mjs.map +0 -1
- package/dist/chunk-236H5JZJ.mjs +0 -1
- package/dist/chunk-236H5JZJ.mjs.map +0 -1
- package/dist/chunk-237HGSZS.mjs +0 -16
- package/dist/chunk-237HGSZS.mjs.map +0 -1
- package/dist/chunk-24FKGR6U.mjs +0 -47
- package/dist/chunk-24FKGR6U.mjs.map +0 -1
- package/dist/chunk-27QMXBLJ.mjs +0 -9
- package/dist/chunk-27QMXBLJ.mjs.map +0 -1
- package/dist/chunk-2IXFGSUA.mjs +0 -16
- package/dist/chunk-2IXFGSUA.mjs.map +0 -1
- package/dist/chunk-2KNLZB7V.mjs +0 -10
- package/dist/chunk-2KNLZB7V.mjs.map +0 -1
- package/dist/chunk-2SLTL4KL.mjs +0 -13
- package/dist/chunk-2SLTL4KL.mjs.map +0 -1
- package/dist/chunk-2ZCITDMK.mjs +0 -13
- package/dist/chunk-2ZCITDMK.mjs.map +0 -1
- package/dist/chunk-33MSBDC6.mjs +0 -21
- package/dist/chunk-33MSBDC6.mjs.map +0 -1
- package/dist/chunk-3EZAFZG3.mjs +0 -10
- package/dist/chunk-3EZAFZG3.mjs.map +0 -1
- package/dist/chunk-3IP4JVLL.mjs +0 -32
- package/dist/chunk-3IP4JVLL.mjs.map +0 -1
- package/dist/chunk-4KYXHZ4R.mjs +0 -17
- package/dist/chunk-4KYXHZ4R.mjs.map +0 -1
- package/dist/chunk-4OIZM4HS.mjs +0 -1
- package/dist/chunk-4OIZM4HS.mjs.map +0 -1
- package/dist/chunk-54TK5BIS.mjs +0 -1
- package/dist/chunk-54TK5BIS.mjs.map +0 -1
- package/dist/chunk-5ASRKEB4.mjs +0 -13
- package/dist/chunk-5ASRKEB4.mjs.map +0 -1
- package/dist/chunk-5IKVJGHO.mjs +0 -14
- package/dist/chunk-5IKVJGHO.mjs.map +0 -1
- package/dist/chunk-5L4VWRFX.mjs +0 -14
- package/dist/chunk-5L4VWRFX.mjs.map +0 -1
- package/dist/chunk-5PMKOZ2F.mjs +0 -13
- package/dist/chunk-5PMKOZ2F.mjs.map +0 -1
- package/dist/chunk-6CLH5YZ2.mjs +0 -16
- package/dist/chunk-6CLH5YZ2.mjs.map +0 -1
- package/dist/chunk-6GWEY5EL.mjs +0 -13
- package/dist/chunk-6GWEY5EL.mjs.map +0 -1
- package/dist/chunk-6NVQAHXP.mjs +0 -13
- package/dist/chunk-6NVQAHXP.mjs.map +0 -1
- package/dist/chunk-7B7W36UP.mjs +0 -29
- package/dist/chunk-7B7W36UP.mjs.map +0 -1
- package/dist/chunk-AIRSKN47.mjs +0 -9
- package/dist/chunk-AIRSKN47.mjs.map +0 -1
- package/dist/chunk-AJKZMN2V.mjs +0 -14
- package/dist/chunk-AJKZMN2V.mjs.map +0 -1
- package/dist/chunk-B4COTK4K.mjs +0 -16
- package/dist/chunk-B4COTK4K.mjs.map +0 -1
- package/dist/chunk-B645AYL4.mjs +0 -1
- package/dist/chunk-B645AYL4.mjs.map +0 -1
- package/dist/chunk-BCTYOXT7.mjs +0 -16
- package/dist/chunk-BCTYOXT7.mjs.map +0 -1
- package/dist/chunk-BH6HLGBA.mjs +0 -16
- package/dist/chunk-BH6HLGBA.mjs.map +0 -1
- package/dist/chunk-BJWAMCFH.mjs +0 -598
- package/dist/chunk-BJWAMCFH.mjs.map +0 -1
- package/dist/chunk-BMRTZMRE.mjs +0 -9
- package/dist/chunk-BMRTZMRE.mjs.map +0 -1
- package/dist/chunk-BOOQBJN2.mjs +0 -9
- package/dist/chunk-BOOQBJN2.mjs.map +0 -1
- package/dist/chunk-CMBC4MXG.mjs +0 -19
- package/dist/chunk-CMBC4MXG.mjs.map +0 -1
- package/dist/chunk-CRSKT4WW.mjs +0 -15
- package/dist/chunk-CRSKT4WW.mjs.map +0 -1
- package/dist/chunk-CVVZHOJX.mjs +0 -22
- package/dist/chunk-CVVZHOJX.mjs.map +0 -1
- package/dist/chunk-DDH7K4QM.mjs +0 -1
- package/dist/chunk-DDH7K4QM.mjs.map +0 -1
- package/dist/chunk-DN3NOZ3H.mjs +0 -18
- package/dist/chunk-DN3NOZ3H.mjs.map +0 -1
- package/dist/chunk-DPH2KE6O.mjs +0 -24
- package/dist/chunk-DPH2KE6O.mjs.map +0 -1
- package/dist/chunk-DTJJIMKJ.mjs +0 -15
- package/dist/chunk-DTJJIMKJ.mjs.map +0 -1
- package/dist/chunk-DVK2N4KC.mjs +0 -9
- package/dist/chunk-DVK2N4KC.mjs.map +0 -1
- package/dist/chunk-DXB7EZUQ.mjs +0 -12
- package/dist/chunk-DXB7EZUQ.mjs.map +0 -1
- package/dist/chunk-E6C5EZQA.mjs +0 -19
- package/dist/chunk-E6C5EZQA.mjs.map +0 -1
- package/dist/chunk-E6E4RZLN.mjs +0 -17
- package/dist/chunk-E6E4RZLN.mjs.map +0 -1
- package/dist/chunk-EHSKB6DF.mjs +0 -26
- package/dist/chunk-EHSKB6DF.mjs.map +0 -1
- package/dist/chunk-EYYZQFOP.mjs +0 -14
- package/dist/chunk-EYYZQFOP.mjs.map +0 -1
- package/dist/chunk-F3WCQQET.mjs +0 -14
- package/dist/chunk-F3WCQQET.mjs.map +0 -1
- package/dist/chunk-F47GLYUU.mjs +0 -1
- package/dist/chunk-F47GLYUU.mjs.map +0 -1
- package/dist/chunk-FUS75PJ7.mjs +0 -1
- package/dist/chunk-FUS75PJ7.mjs.map +0 -1
- package/dist/chunk-FVVSE2F2.mjs +0 -12
- package/dist/chunk-FVVSE2F2.mjs.map +0 -1
- package/dist/chunk-G7UQ5PUR.mjs +0 -14
- package/dist/chunk-G7UQ5PUR.mjs.map +0 -1
- package/dist/chunk-GIWAOOFY.mjs +0 -13
- package/dist/chunk-GIWAOOFY.mjs.map +0 -1
- package/dist/chunk-HM2JT2RX.mjs +0 -9
- package/dist/chunk-HM2JT2RX.mjs.map +0 -1
- package/dist/chunk-HPFDYUGP.mjs +0 -13
- package/dist/chunk-HPFDYUGP.mjs.map +0 -1
- package/dist/chunk-IDCUZVJL.mjs +0 -18
- package/dist/chunk-IDCUZVJL.mjs.map +0 -1
- package/dist/chunk-IEA53J7P.mjs +0 -12
- package/dist/chunk-IEA53J7P.mjs.map +0 -1
- package/dist/chunk-IFNXROZR.mjs +0 -18
- package/dist/chunk-IFNXROZR.mjs.map +0 -1
- package/dist/chunk-IIDZ3KAJ.mjs +0 -18
- package/dist/chunk-IIDZ3KAJ.mjs.map +0 -1
- package/dist/chunk-IJD7FE2Z.mjs +0 -18
- package/dist/chunk-IJD7FE2Z.mjs.map +0 -1
- package/dist/chunk-IQLKIDXF.mjs +0 -12
- package/dist/chunk-IQLKIDXF.mjs.map +0 -1
- package/dist/chunk-JPUKH67K.mjs +0 -10
- package/dist/chunk-JPUKH67K.mjs.map +0 -1
- package/dist/chunk-JYSV56US.mjs +0 -41
- package/dist/chunk-JYSV56US.mjs.map +0 -1
- package/dist/chunk-KIOYQRMQ.mjs +0 -12
- package/dist/chunk-KIOYQRMQ.mjs.map +0 -1
- package/dist/chunk-KPBQ7OUY.mjs +0 -9
- package/dist/chunk-KPBQ7OUY.mjs.map +0 -1
- package/dist/chunk-L7FQX5MN.mjs +0 -19
- package/dist/chunk-L7FQX5MN.mjs.map +0 -1
- package/dist/chunk-LJ2C6MVP.mjs +0 -13
- package/dist/chunk-LJ2C6MVP.mjs.map +0 -1
- package/dist/chunk-LKXCOLNY.mjs +0 -8
- package/dist/chunk-LKXCOLNY.mjs.map +0 -1
- package/dist/chunk-LVWX5B43.mjs +0 -12
- package/dist/chunk-LVWX5B43.mjs.map +0 -1
- package/dist/chunk-M7SBBYV2.mjs +0 -14
- package/dist/chunk-M7SBBYV2.mjs.map +0 -1
- package/dist/chunk-ME352XO7.mjs +0 -9
- package/dist/chunk-ME352XO7.mjs.map +0 -1
- package/dist/chunk-MIGAC7F4.mjs +0 -25
- package/dist/chunk-MIGAC7F4.mjs.map +0 -1
- package/dist/chunk-ML727RRJ.mjs +0 -13
- package/dist/chunk-ML727RRJ.mjs.map +0 -1
- package/dist/chunk-MLCL773E.mjs +0 -12
- package/dist/chunk-MLCL773E.mjs.map +0 -1
- package/dist/chunk-MY4G7R3I.mjs +0 -14
- package/dist/chunk-MY4G7R3I.mjs.map +0 -1
- package/dist/chunk-NFS7RWWE.mjs +0 -16
- package/dist/chunk-NFS7RWWE.mjs.map +0 -1
- package/dist/chunk-NKLIE2OI.mjs +0 -1
- package/dist/chunk-NKLIE2OI.mjs.map +0 -1
- package/dist/chunk-NTLX2MPV.mjs +0 -14
- package/dist/chunk-NTLX2MPV.mjs.map +0 -1
- package/dist/chunk-O64NE2P4.mjs +0 -26
- package/dist/chunk-O64NE2P4.mjs.map +0 -1
- package/dist/chunk-O6UXZR3U.mjs +0 -10
- package/dist/chunk-O6UXZR3U.mjs.map +0 -1
- package/dist/chunk-OLX53VEF.mjs +0 -16
- package/dist/chunk-OLX53VEF.mjs.map +0 -1
- package/dist/chunk-OOKNBU4V.mjs +0 -18
- package/dist/chunk-OOKNBU4V.mjs.map +0 -1
- package/dist/chunk-OP4OAKQJ.mjs +0 -16
- package/dist/chunk-OP4OAKQJ.mjs.map +0 -1
- package/dist/chunk-OXZCMC5I.mjs +0 -13
- package/dist/chunk-OXZCMC5I.mjs.map +0 -1
- package/dist/chunk-PYEYV7BY.mjs +0 -10
- package/dist/chunk-PYEYV7BY.mjs.map +0 -1
- package/dist/chunk-Q47NGNXT.mjs +0 -21
- package/dist/chunk-Q47NGNXT.mjs.map +0 -1
- package/dist/chunk-QOJGMVVR.mjs +0 -17
- package/dist/chunk-QOJGMVVR.mjs.map +0 -1
- package/dist/chunk-QRSJBBFY.mjs +0 -21
- package/dist/chunk-QRSJBBFY.mjs.map +0 -1
- package/dist/chunk-QXTNZR7B.mjs +0 -25
- package/dist/chunk-QXTNZR7B.mjs.map +0 -1
- package/dist/chunk-R6QA7PLZ.mjs +0 -13
- package/dist/chunk-R6QA7PLZ.mjs.map +0 -1
- package/dist/chunk-SYWMYQYJ.mjs +0 -16
- package/dist/chunk-SYWMYQYJ.mjs.map +0 -1
- package/dist/chunk-TJ4Z5I7M.mjs +0 -17
- package/dist/chunk-TJ4Z5I7M.mjs.map +0 -1
- package/dist/chunk-U4JGKZ56.mjs +0 -41
- package/dist/chunk-U4JGKZ56.mjs.map +0 -1
- package/dist/chunk-U56ZOM7L.mjs +0 -9
- package/dist/chunk-U56ZOM7L.mjs.map +0 -1
- package/dist/chunk-UY76KTPE.mjs +0 -13
- package/dist/chunk-UY76KTPE.mjs.map +0 -1
- package/dist/chunk-UYZKMBDO.mjs +0 -22
- package/dist/chunk-UYZKMBDO.mjs.map +0 -1
- package/dist/chunk-VH2PV426.mjs +0 -9
- package/dist/chunk-VH2PV426.mjs.map +0 -1
- package/dist/chunk-WFZXCGEG.mjs +0 -17
- package/dist/chunk-WFZXCGEG.mjs.map +0 -1
- package/dist/chunk-WMM7TZLG.mjs +0 -9
- package/dist/chunk-WMM7TZLG.mjs.map +0 -1
- package/dist/chunk-WVQ7YVRK.mjs +0 -11
- package/dist/chunk-WVQ7YVRK.mjs.map +0 -1
- package/dist/chunk-XGQWTHW6.mjs +0 -34
- package/dist/chunk-XGQWTHW6.mjs.map +0 -1
- package/dist/chunk-XI7KRD2C.mjs +0 -13
- package/dist/chunk-XI7KRD2C.mjs.map +0 -1
- package/dist/chunk-XPSOKBRZ.mjs +0 -12
- package/dist/chunk-XPSOKBRZ.mjs.map +0 -1
- package/dist/chunk-XT74R35S.mjs +0 -1
- package/dist/chunk-XT74R35S.mjs.map +0 -1
- package/dist/chunk-Y5V7UAZZ.mjs +0 -21
- package/dist/chunk-Y5V7UAZZ.mjs.map +0 -1
- package/dist/chunk-YFN6KOC4.mjs +0 -15
- package/dist/chunk-YFN6KOC4.mjs.map +0 -1
- package/dist/compat/index.js.map +0 -1
- package/dist/compat/index.mjs.map +0 -1
- package/dist/error/AbortError.js +0 -36
- package/dist/error/AbortError.js.map +0 -1
- package/dist/error/AbortError.mjs.map +0 -1
- package/dist/error/TimeoutError.js +0 -36
- package/dist/error/TimeoutError.js.map +0 -1
- package/dist/error/TimeoutError.mjs.map +0 -1
- package/dist/error/index.d.mts +0 -2
- package/dist/error/index.d.ts +0 -2
- package/dist/error/index.js +0 -48
- package/dist/error/index.js.map +0 -1
- package/dist/error/index.mjs +0 -13
- package/dist/error/index.mjs.map +0 -1
- package/dist/function/debounce.js +0 -56
- package/dist/function/debounce.js.map +0 -1
- package/dist/function/debounce.mjs.map +0 -1
- package/dist/function/index.js.map +0 -1
- package/dist/function/index.mjs.map +0 -1
- package/dist/function/negate.js +0 -33
- package/dist/function/negate.js.map +0 -1
- package/dist/function/negate.mjs.map +0 -1
- package/dist/function/noop.js +0 -32
- package/dist/function/noop.js.map +0 -1
- package/dist/function/noop.mjs.map +0 -1
- package/dist/function/once.js +0 -43
- package/dist/function/once.js.map +0 -1
- package/dist/function/once.mjs.map +0 -1
- package/dist/function/throttle.js +0 -41
- package/dist/function/throttle.js.map +0 -1
- package/dist/function/throttle.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/math/clamp.js +0 -36
- package/dist/math/clamp.js.map +0 -1
- package/dist/math/clamp.mjs.map +0 -1
- package/dist/math/inRange.js +0 -40
- package/dist/math/inRange.js.map +0 -1
- package/dist/math/inRange.mjs.map +0 -1
- package/dist/math/index.js.map +0 -1
- package/dist/math/index.mjs.map +0 -1
- package/dist/math/mean.js +0 -44
- package/dist/math/mean.js.map +0 -1
- package/dist/math/mean.mjs.map +0 -1
- package/dist/math/meanBy.js +0 -50
- package/dist/math/meanBy.js.map +0 -1
- package/dist/math/meanBy.mjs.map +0 -1
- package/dist/math/random.js +0 -40
- package/dist/math/random.js.map +0 -1
- package/dist/math/random.mjs.map +0 -1
- package/dist/math/randomInt.js +0 -47
- package/dist/math/randomInt.js.map +0 -1
- package/dist/math/randomInt.mjs.map +0 -1
- package/dist/math/range.js +0 -48
- package/dist/math/range.js.map +0 -1
- package/dist/math/range.mjs.map +0 -1
- package/dist/math/round.js +0 -37
- package/dist/math/round.js.map +0 -1
- package/dist/math/round.mjs.map +0 -1
- package/dist/math/sum.js +0 -37
- package/dist/math/sum.js.map +0 -1
- package/dist/math/sum.mjs.map +0 -1
- package/dist/math/sumBy.js +0 -45
- package/dist/math/sumBy.js.map +0 -1
- package/dist/math/sumBy.mjs.map +0 -1
- package/dist/object/clone.js +0 -65
- package/dist/object/clone.js.map +0 -1
- package/dist/object/clone.mjs.map +0 -1
- package/dist/object/flattenObject.js +0 -77
- package/dist/object/flattenObject.js.map +0 -1
- package/dist/object/flattenObject.mjs.map +0 -1
- package/dist/object/index.js.map +0 -1
- package/dist/object/index.mjs.map +0 -1
- package/dist/object/invert.js +0 -40
- package/dist/object/invert.js.map +0 -1
- package/dist/object/invert.mjs.map +0 -1
- package/dist/object/omit.js +0 -51
- package/dist/object/omit.js.map +0 -1
- package/dist/object/omit.mjs.map +0 -1
- package/dist/object/omitBy.js +0 -40
- package/dist/object/omitBy.js.map +0 -1
- package/dist/object/omitBy.mjs.map +0 -1
- package/dist/object/pick.js +0 -37
- package/dist/object/pick.js.map +0 -1
- package/dist/object/pick.mjs.map +0 -1
- package/dist/object/pickBy.js +0 -40
- package/dist/object/pickBy.js.map +0 -1
- package/dist/object/pickBy.mjs.map +0 -1
- package/dist/predicate/index.js.map +0 -1
- package/dist/predicate/index.mjs.map +0 -1
- package/dist/predicate/isEqual.js +0 -73
- package/dist/predicate/isEqual.js.map +0 -1
- package/dist/predicate/isEqual.mjs.map +0 -1
- package/dist/predicate/isLength.js +0 -33
- package/dist/predicate/isLength.js.map +0 -1
- package/dist/predicate/isLength.mjs.map +0 -1
- package/dist/predicate/isNil.js +0 -33
- package/dist/predicate/isNil.js.map +0 -1
- package/dist/predicate/isNil.mjs.map +0 -1
- package/dist/predicate/isNotNil.js +0 -33
- package/dist/predicate/isNotNil.js.map +0 -1
- package/dist/predicate/isNotNil.mjs.map +0 -1
- package/dist/predicate/isNull.js +0 -33
- package/dist/predicate/isNull.js.map +0 -1
- package/dist/predicate/isNull.mjs.map +0 -1
- package/dist/predicate/isPlainObject.js +0 -49
- package/dist/predicate/isPlainObject.js.map +0 -1
- package/dist/predicate/isPlainObject.mjs.map +0 -1
- package/dist/predicate/isUndefined.js +0 -33
- package/dist/predicate/isUndefined.js.map +0 -1
- package/dist/predicate/isUndefined.mjs.map +0 -1
- package/dist/promise/delay.js +0 -56
- package/dist/promise/delay.js.map +0 -1
- package/dist/promise/delay.mjs.map +0 -1
- package/dist/promise/index.js.map +0 -1
- package/dist/promise/index.mjs.map +0 -1
- package/dist/promise/timeout.d.mts +0 -10
- package/dist/promise/timeout.d.ts +0 -10
- package/dist/promise/timeout.js +0 -92
- package/dist/promise/timeout.js.map +0 -1
- package/dist/promise/timeout.mjs.map +0 -1
- package/dist/promise/withTimeout.js +0 -99
- package/dist/promise/withTimeout.js.map +0 -1
- package/dist/promise/withTimeout.mjs.map +0 -1
- package/dist/string/camelCase.js +0 -52
- package/dist/string/camelCase.js.map +0 -1
- package/dist/string/camelCase.mjs.map +0 -1
- package/dist/string/capitalize.js +0 -33
- package/dist/string/capitalize.js.map +0 -1
- package/dist/string/capitalize.mjs.map +0 -1
- package/dist/string/index.js.map +0 -1
- package/dist/string/index.mjs.map +0 -1
- package/dist/string/kebabCase.js +0 -43
- package/dist/string/kebabCase.js.map +0 -1
- package/dist/string/kebabCase.mjs.map +0 -1
- package/dist/string/lowerCase.js +0 -43
- package/dist/string/lowerCase.js.map +0 -1
- package/dist/string/lowerCase.mjs.map +0 -1
- package/dist/string/snakeCase.js +0 -43
- package/dist/string/snakeCase.js.map +0 -1
- package/dist/string/snakeCase.mjs.map +0 -1
- package/dist/string/startCase.js +0 -54
- package/dist/string/startCase.js.map +0 -1
- package/dist/string/startCase.mjs.map +0 -1
- package/umd/browser.global.js +0 -2
package/dist/array/flatMap.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/flatMap.ts
|
|
21
|
-
var flatMap_exports = {};
|
|
22
|
-
__export(flatMap_exports, {
|
|
23
|
-
flatMap: () => flatMap
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(flatMap_exports);
|
|
26
|
-
|
|
27
|
-
// src/array/flatten.ts
|
|
28
|
-
function flatten(arr, depth = 1) {
|
|
29
|
-
const result = [];
|
|
30
|
-
const flooredDepth = Math.floor(depth);
|
|
31
|
-
const recursive = (arr2, currentDepth) => {
|
|
32
|
-
for (const item of arr2) {
|
|
33
|
-
if (Array.isArray(item) && currentDepth < flooredDepth) {
|
|
34
|
-
recursive(item, currentDepth + 1);
|
|
35
|
-
} else {
|
|
36
|
-
result.push(item);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
recursive(arr, 0);
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/array/flatMap.ts
|
|
45
|
-
function flatMap(arr, iteratee, depth = 1) {
|
|
46
|
-
return flatten(arr.map((item) => iteratee(item)), depth);
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
flatMap
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=flatMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/flatMap.ts","../../src/array/flatten.ts"],"sourcesContent":["import { flatten } from './flatten.ts';\n\n/**\n * Maps each element in the array using the iteratee function and flattens the result up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template U - The type of elements within the returned array from the iteratee function.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {(item: T) => U} iteratee - The function that produces the new array elements.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<U[], D>>} The new array with the mapped and flattened elements.\n *\n * @example\n * const arr = [1, 2, 3];\n *\n * flatMap(arr, (item: number) => [item, item]);\n * // [1, 1, 2, 2, 3, 3]\n *\n * flatMap(arr, (item: number) => [[item, item]], 2);\n * // [1, 1, 2, 2, 3, 3]\n */\nexport function flatMap<T, U, D extends number>(\n arr: readonly T[],\n iteratee: (item: T) => U,\n depth = 1 as D\n): Array<FlatArray<U[], D>> {\n return flatten(arr.map(item => iteratee(item)), depth);\n}\n","/**\n * Flattens an array up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<T[], D>>} A new array that has been flattened.\n *\n * @example\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1);\n * // Returns: [1, 2, 3, 4, [5, 6]]\n *\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flatten<T, D extends number = 1>(arr: readonly T[], depth = 1 as D): Array<FlatArray<T[], D>> {\n const result: Array<FlatArray<T[], D>> = [];\n const flooredDepth = Math.floor(depth);\n\n const recursive = (arr: readonly T[], currentDepth: number) => {\n for (const item of arr) {\n if (Array.isArray(item) && currentDepth < flooredDepth) {\n recursive(item, currentDepth + 1);\n } else {\n result.push(item as FlatArray<T[], D>);\n }\n }\n };\n\n recursive(arr, 0);\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,SAAS,QAAiC,KAAmB,QAAQ,GAAkC;AAC5G,QAAM,SAAmC,CAAC;AAC1C,QAAM,eAAe,KAAK,MAAM,KAAK;AAErC,QAAM,YAAY,CAACA,MAAmB,iBAAyB;AAC7D,eAAW,QAAQA,MAAK;AACtB,UAAI,MAAM,QAAQ,IAAI,KAAK,eAAe,cAAc;AACtD,kBAAU,MAAM,eAAe,CAAC;AAAA,MAClC,OAAO;AACL,eAAO,KAAK,IAAyB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,YAAU,KAAK,CAAC;AAChB,SAAO;AACT;;;ADVO,SAAS,QACd,KACA,UACA,QAAQ,GACkB;AAC1B,SAAO,QAAQ,IAAI,IAAI,UAAQ,SAAS,IAAI,CAAC,GAAG,KAAK;AACvD;","names":["arr"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/array/flatten.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/flatten.ts
|
|
21
|
-
var flatten_exports = {};
|
|
22
|
-
__export(flatten_exports, {
|
|
23
|
-
flatten: () => flatten
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(flatten_exports);
|
|
26
|
-
function flatten(arr, depth = 1) {
|
|
27
|
-
const result = [];
|
|
28
|
-
const flooredDepth = Math.floor(depth);
|
|
29
|
-
const recursive = (arr2, currentDepth) => {
|
|
30
|
-
for (const item of arr2) {
|
|
31
|
-
if (Array.isArray(item) && currentDepth < flooredDepth) {
|
|
32
|
-
recursive(item, currentDepth + 1);
|
|
33
|
-
} else {
|
|
34
|
-
result.push(item);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
recursive(arr, 0);
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
flatten
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=flatten.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/flatten.ts"],"sourcesContent":["/**\n * Flattens an array up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<T[], D>>} A new array that has been flattened.\n *\n * @example\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1);\n * // Returns: [1, 2, 3, 4, [5, 6]]\n *\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flatten<T, D extends number = 1>(arr: readonly T[], depth = 1 as D): Array<FlatArray<T[], D>> {\n const result: Array<FlatArray<T[], D>> = [];\n const flooredDepth = Math.floor(depth);\n\n const recursive = (arr: readonly T[], currentDepth: number) => {\n for (const item of arr) {\n if (Array.isArray(item) && currentDepth < flooredDepth) {\n recursive(item, currentDepth + 1);\n } else {\n result.push(item as FlatArray<T[], D>);\n }\n }\n };\n\n recursive(arr, 0);\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,QAAiC,KAAmB,QAAQ,GAAkC;AAC5G,QAAM,SAAmC,CAAC;AAC1C,QAAM,eAAe,KAAK,MAAM,KAAK;AAErC,QAAM,YAAY,CAACA,MAAmB,iBAAyB;AAC7D,eAAW,QAAQA,MAAK;AACtB,UAAI,MAAM,QAAQ,IAAI,KAAK,eAAe,cAAc;AACtD,kBAAU,MAAM,eAAe,CAAC;AAAA,MAClC,OAAO;AACL,eAAO,KAAK,IAAyB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,YAAU,KAAK,CAAC;AAChB,SAAO;AACT;","names":["arr"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/flattenDeep.ts
|
|
21
|
-
var flattenDeep_exports = {};
|
|
22
|
-
__export(flattenDeep_exports, {
|
|
23
|
-
flattenDeep: () => flattenDeep
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(flattenDeep_exports);
|
|
26
|
-
|
|
27
|
-
// src/array/flatten.ts
|
|
28
|
-
function flatten(arr, depth = 1) {
|
|
29
|
-
const result = [];
|
|
30
|
-
const flooredDepth = Math.floor(depth);
|
|
31
|
-
const recursive = (arr2, currentDepth) => {
|
|
32
|
-
for (const item of arr2) {
|
|
33
|
-
if (Array.isArray(item) && currentDepth < flooredDepth) {
|
|
34
|
-
recursive(item, currentDepth + 1);
|
|
35
|
-
} else {
|
|
36
|
-
result.push(item);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
recursive(arr, 0);
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/array/flattenDeep.ts
|
|
45
|
-
function flattenDeep(arr) {
|
|
46
|
-
return flatten(arr, Infinity);
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
flattenDeep
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=flattenDeep.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/flattenDeep.ts","../../src/array/flatten.ts"],"sourcesContent":["import { flatten } from './flatten.ts';\n\n/**\n * Utility type for recursively unpacking nested array types to extract the type of the innermost element\n *\n * @example\n * ExtractNestedArrayType<(number | (number | number[])[])[]>\n * // number\n *\n * ExtractNestedArrayType<(boolean | (string | number[])[])[]>\n * // string | number | boolean\n */\ntype ExtractNestedArrayType<T> = T extends ReadonlyArray<infer U> ? ExtractNestedArrayType<U> : T;\n\n/**\n * Flattens all depths of a nested array.\n *\n * @template T - The type of elements within the array.\n * @param {T[]} arr - The array to flatten.\n * @returns {Array<ExtractNestedArrayType<T>>} A new array that has been flattened.\n *\n * @example\n * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flattenDeep<T>(arr: readonly T[]): Array<ExtractNestedArrayType<T>> {\n return flatten(arr, Infinity) as Array<ExtractNestedArrayType<T>>;\n}\n","/**\n * Flattens an array up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<T[], D>>} A new array that has been flattened.\n *\n * @example\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1);\n * // Returns: [1, 2, 3, 4, [5, 6]]\n *\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flatten<T, D extends number = 1>(arr: readonly T[], depth = 1 as D): Array<FlatArray<T[], D>> {\n const result: Array<FlatArray<T[], D>> = [];\n const flooredDepth = Math.floor(depth);\n\n const recursive = (arr: readonly T[], currentDepth: number) => {\n for (const item of arr) {\n if (Array.isArray(item) && currentDepth < flooredDepth) {\n recursive(item, currentDepth + 1);\n } else {\n result.push(item as FlatArray<T[], D>);\n }\n }\n };\n\n recursive(arr, 0);\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,SAAS,QAAiC,KAAmB,QAAQ,GAAkC;AAC5G,QAAM,SAAmC,CAAC;AAC1C,QAAM,eAAe,KAAK,MAAM,KAAK;AAErC,QAAM,YAAY,CAACA,MAAmB,iBAAyB;AAC7D,eAAW,QAAQA,MAAK;AACtB,UAAI,MAAM,QAAQ,IAAI,KAAK,eAAe,cAAc;AACtD,kBAAU,MAAM,eAAe,CAAC;AAAA,MAClC,OAAO;AACL,eAAO,KAAK,IAAyB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,YAAU,KAAK,CAAC;AAChB,SAAO;AACT;;;ADPO,SAAS,YAAe,KAAqD;AAClF,SAAO,QAAQ,KAAK,QAAQ;AAC9B;","names":["arr"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/forEachRight.ts
|
|
21
|
-
var forEachRight_exports = {};
|
|
22
|
-
__export(forEachRight_exports, {
|
|
23
|
-
forEachRight: () => forEachRight
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(forEachRight_exports);
|
|
26
|
-
function forEachRight(arr, callback) {
|
|
27
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
28
|
-
const element = arr[i];
|
|
29
|
-
callback(element, i, arr);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
forEachRight
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=forEachRight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/forEachRight.ts"],"sourcesContent":["/**\n * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.\n * \n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to iterate over.\n * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration.\n * The callback function receives three arguments:\n * - 'value': The current element being processed in the array.\n * - 'index': The index of the current element being processed in the array.\n * - 'arr': The array 'forEachRight' was called upon.\n * \n * @example\n * const array = [1, 2, 3];\n * const result: number[] = [];\n * \n * // Use the forEachRight function to iterate through the array and add each element to the result array.\n * forEachRight(array, (value) => {\n * result.push(value);\n * })\n * \n * console.log(result) // Output: [3, 2, 1]\n */\n\nexport function forEachRight<T>(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void {\n for (let i = arr.length - 1; i >= 0; i--) {\n const element = arr[i];\n callback(element, i, arr);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,aAAgB,KAAU,UAA6D;AACrG,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,UAAM,UAAU,IAAI,CAAC;AACrB,aAAS,SAAS,GAAG,GAAG;AAAA,EAC1B;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/array/groupBy.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/groupBy.ts
|
|
21
|
-
var groupBy_exports = {};
|
|
22
|
-
__export(groupBy_exports, {
|
|
23
|
-
groupBy: () => groupBy
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(groupBy_exports);
|
|
26
|
-
function groupBy(arr, getKeyFromItem) {
|
|
27
|
-
const result = {};
|
|
28
|
-
for (const item of arr) {
|
|
29
|
-
const key = getKeyFromItem(item);
|
|
30
|
-
if (result[key] == null) {
|
|
31
|
-
result[key] = [];
|
|
32
|
-
}
|
|
33
|
-
result[key].push(item);
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
groupBy
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=groupBy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/groupBy.ts"],"sourcesContent":["/**\n * Groups the elements of an array based on a provided key-generating function.\n *\n * This function takes an array and a function that generates a key from each element. It returns\n * an object where the keys are the generated keys and the values are arrays of elements that share\n * the same key.\n *\n * @template T - The type of elements in the array.\n * @template K - The type of keys.\n * @param {T[]} arr - The array to group.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that\n * share that key.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = groupBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: [\n * // { category: 'fruit', name: 'apple' },\n * // { category: 'fruit', name: 'banana' }\n * // ],\n * // vegetable: [\n * // { category: 'vegetable', name: 'carrot' }\n * // ]\n * // }\n */\nexport function groupBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n\n if (result[key] == null) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,SAAS,QAAkC,KAAmB,gBAAgD;AACnH,QAAM,SAAS,CAAC;AAEhB,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,eAAe,IAAI;AAE/B,QAAI,OAAO,GAAG,KAAK,MAAM;AACvB,aAAO,GAAG,IAAI,CAAC;AAAA,IACjB;AAEA,WAAO,GAAG,EAAE,KAAK,IAAI;AAAA,EACvB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/array/head.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/head.ts
|
|
21
|
-
var head_exports = {};
|
|
22
|
-
__export(head_exports, {
|
|
23
|
-
head: () => head
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(head_exports);
|
|
26
|
-
function head(arr) {
|
|
27
|
-
return arr[0];
|
|
28
|
-
}
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
head
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=head.js.map
|
package/dist/array/head.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/head.ts"],"sourcesContent":["/**\n * Returns the first element of an array.\n *\n * This function takes an array and returns the first element of the array.\n * If the array is empty, the function returns `undefined`.\n *\n * @param {T[]} arr - The array from which to get the first element.\n * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty.\n *\n * @example\n * const arr = [1, 2, 3];\n * const firstElement = head(arr);\n * // firstElement will be 1\n *\n * const emptyArr: number[] = [];\n * const noElement = head(emptyArr);\n * // noElement will be undefined\n */\nexport function head<T>(arr: readonly [T, ...T[]]): T;\nexport function head<T>(arr: readonly T[]): T | undefined;\nexport function head<T>(arr: readonly T[]): T | undefined {\n return arr[0];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,KAAQ,KAAkC;AACxD,SAAO,IAAI,CAAC;AACd;","names":[]}
|
package/dist/array/head.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/array/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/index.ts","../../src/array/chunk.ts","../../src/array/compact.ts","../../src/array/countBy.ts","../../src/array/difference.ts","../../src/array/differenceBy.ts","../../src/array/differenceWith.ts","../../src/array/drop.ts","../../src/array/dropRight.ts","../../src/array/dropRightWhile.ts","../../src/array/dropWhile.ts","../../src/array/fill.ts","../../src/array/flatten.ts","../../src/array/flatMap.ts","../../src/array/flattenDeep.ts","../../src/array/forEachRight.ts","../../src/array/groupBy.ts","../../src/array/intersection.ts","../../src/array/intersectionBy.ts","../../src/array/intersectionWith.ts","../../src/array/keyBy.ts","../../src/array/maxBy.ts","../../src/array/minBy.ts","../../src/array/orderBy.ts","../../src/array/partition.ts","../../src/array/sample.ts","../../src/math/random.ts","../../src/math/randomInt.ts","../../src/array/sampleSize.ts","../../src/array/shuffle.ts","../../src/array/take.ts","../../src/array/takeRight.ts","../../src/array/takeRightWhile.ts","../../src/array/takeWhile.ts","../../src/array/uniq.ts","../../src/array/union.ts","../../src/array/unionBy.ts","../../src/array/uniqWith.ts","../../src/array/unionWith.ts","../../src/array/uniqBy.ts","../../src/array/unzip.ts","../../src/array/unzipWith.ts","../../src/array/xor.ts","../../src/array/xorBy.ts","../../src/array/xorWith.ts","../../src/array/zip.ts","../../src/array/zipObject.ts","../../src/array/zipWith.ts","../../src/array/without.ts","../../src/array/head.ts","../../src/array/tail.ts","../../src/array/toFilled.ts","../../src/array/last.ts","../../src/array/initial.ts"],"sourcesContent":["export { chunk } from './chunk.ts';\nexport { compact } from './compact.ts';\nexport { countBy } from './countBy.ts';\nexport { difference } from './difference.ts';\nexport { differenceBy } from './differenceBy.ts';\nexport { differenceWith } from './differenceWith.ts';\nexport { drop } from './drop.ts';\nexport { dropRight } from './dropRight.ts';\nexport { dropRightWhile } from './dropRightWhile.ts';\nexport { dropWhile } from './dropWhile.ts';\nexport { fill } from './fill.ts';\nexport { flatMap } from './flatMap.ts';\nexport { flatten } from './flatten.ts';\nexport { flattenDeep } from './flattenDeep.ts';\nexport { forEachRight } from './forEachRight.ts';\nexport { groupBy } from './groupBy.ts';\nexport { intersection } from './intersection.ts';\nexport { intersectionBy } from './intersectionBy.ts';\nexport { intersectionWith } from './intersectionWith.ts';\nexport { keyBy } from './keyBy.ts';\nexport { maxBy } from './maxBy.ts';\nexport { minBy } from './minBy.ts';\nexport { orderBy } from './orderBy.ts';\nexport { partition } from './partition.ts';\nexport { sample } from './sample.ts';\nexport { sampleSize } from './sampleSize.ts';\nexport { shuffle } from './shuffle.ts';\nexport { take } from './take.ts';\nexport { takeRight } from './takeRight.ts';\nexport { takeRightWhile } from './takeRightWhile.ts';\nexport { takeWhile } from './takeWhile.ts';\nexport { union } from './union.ts';\nexport { unionBy } from './unionBy.ts';\nexport { unionWith } from './unionWith.ts';\nexport { uniq } from './uniq.ts';\nexport { uniqBy } from './uniqBy.ts';\nexport { uniqWith } from './uniqWith.ts';\nexport { unzip } from './unzip.ts';\nexport { unzipWith } from './unzipWith.ts';\nexport { xor } from './xor.ts';\nexport { xorBy } from './xorBy.ts';\nexport { xorWith } from './xorWith.ts';\nexport { zip } from './zip.ts';\nexport { zipObject } from './zipObject.ts';\nexport { zipWith } from './zipWith.ts';\nexport { without } from './without.ts';\nexport { head } from './head.ts';\nexport { tail } from './tail.ts';\nexport { toFilled } from './toFilled.ts';\nexport { last } from './last.ts';\nexport { initial } from './initial.ts';\n","/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number): T[][] {\n if (!Number.isInteger(size) || size <= 0) {\n throw new Error('Size must be an integer greater than zero.');\n }\n\n const chunkLength = Math.ceil(arr.length / size);\n const result: T[][] = Array(chunkLength);\n\n for (let index = 0; index < chunkLength; index++) {\n const start = index * size;\n const end = start + size;\n\n result[index] = arr.slice(start, end);\n }\n\n return result;\n}\n","type NotFalsey<T> = Exclude<T, false | null | 0 | '' | undefined>;\n\n/**\n * Removes falsey values (false, null, 0, '', undefined, NaN) from an array.\n *\n * @template T - The type of elements in the array.\n * @param {readonly T[]} arr - The input array to remove falsey values.\n * @returns {Array<Exclude<T, false | null | 0 | '' | undefined>>} - A new array with all falsey values removed.\n *\n * @example\n * compact([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);\n * Returns: [1, 2, 3, 4, 5]\n */\nexport function compact<T>(arr: readonly T[]): Array<NotFalsey<T>> {\n const result: Array<NotFalsey<T>> = [];\n\n for (const item of arr) {\n if (item) {\n result.push(item as NotFalsey<T>);\n }\n }\n\n return result;\n}\n","/**\n * Count the occurrences of each item in an array\n * based on a transformation function.\n *\n * This function takes an array and a transformation function\n * that converts each item in the array to a string. It then\n * counts the occurrences of each transformed item and returns\n * an object with the transformed items as keys and the counts\n * as values.\n *\n * @template T - The type of the items in the input array.\n *\n * @param {T[]} arr - The input array to count occurrences.\n * @param {(item: T) => string} mapper - The transformation function that maps each item to a string key.\n * @returns {Record<string, number>} An object containing the transformed items as keys and the\n * counts as values.\n */\nexport function countBy<T>(arr: T[], mapper: (item: T) => string): Record<string, number> {\n const result: Record<string, number> = {};\n \n for (const item of arr) {\n const key = mapper(item);\n \n result[key] = (result[key] ?? 0) + 1;\n }\n \n return result;\n}\n","/**\n * Computes the difference between two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements\n * that are present in the first array but not in the second array. It effectively\n * filters out any elements from the first array that also appear in the second array.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to derive the difference. This is the primary array\n * from which elements will be compared and filtered.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * Each element in this array will be checked against the first array, and if a match is found,\n * that element will be excluded from the result.\n * @returns {T[]} A new array containing the elements that are present in the first array but not\n * in the second array.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [2, 4];\n * const result = difference(array1, array2);\n * // result will be [1, 3, 5] since 2 and 4 are in both arrays and are excluded from the result.\n */\nexport function difference<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => !secondSet.has(item));\n}\n","/**\n * Computes the difference between two arrays after mapping their elements through a provided function.\n *\n * This function takes two arrays and a mapper function. It returns a new array containing the elements\n * that are present in the first array but not in the second array, based on the identity calculated\n * by the mapper function.\n *\n * Essentially, it filters out any elements from the first array that, when\n * mapped, match an element in the mapped version of the second array.\n *\n * @template T, U\n * @param {T[]} firstArr - The primary array from which to derive the difference.\n * @param {T[]} secondArr - The array containing elements to be excluded from the first array.\n * @param {(value: T) => U} mapper - The function to map the elements of both arrays. This function\n * is applied to each element in both arrays, and the comparison is made based on the mapped values.\n * @returns {T[]} A new array containing the elements from the first array that do not have a corresponding\n * mapped identity in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = differenceBy(array1, array2, mapper);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are in both arrays and are excluded from the result.\n */\nexport function differenceBy<T, U>(firstArr: readonly T[], secondArr: readonly T[], mapper: (value: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));\n\n return firstArr.filter(item => {\n return !mappedSecondSet.has(mapper(item));\n });\n}\n","/**\n * Computes the difference between two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom comparison function. It returns a new array containing\n * the elements that are present in the first array but not in the second array. The comparison to determine\n * if elements are equal is made using the provided custom function.\n *\n * @template T\n * @param {T[]} firstArr - The array from which to get the difference.\n * @param {T[]} secondArr - The array containing elements to exclude from the first array.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A function to determine if two items are equal.\n * @returns {T[]} A new array containing the elements from the first array that do not match any elements in the second array\n * according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = differenceWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 3 }] since the elements with id 2 are considered equal and are excluded from the result.\n */\nexport function differenceWith<T>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.every(secondItem => {\n return !areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.max(itemsCount, 0);\n\n return arr.slice(itemsCount);\n}\n","/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.min(-itemsCount, 0);\n\n if (itemsCount === 0) {\n return arr.slice();\n }\n\n return arr.slice(0, itemsCount);\n}\n","/**\n * Removes elements from the end of an array until the predicate returns false.\n *\n * This function iterates over an array from the end and drops elements until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element from the end,\n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n for (let i = arr.length - 1; i >= 0; i--) {\n if (!canContinueDropping(arr[i])) {\n return arr.slice(0, i + 1);\n }\n }\n\n return [];\n}\n","/**\n * Removes elements from the beginning of an array until the predicate returns false.\n *\n * This function iterates over an array and drops elements from the start until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element, and dropping\n * continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropWhile(array, x => x < 3);\n * // result will be [3, 4, 5] since elements less than 3 are dropped.\n */\nexport function dropWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n const dropEndIndex = arr.findIndex(item => !canContinueDropping(item));\n if (dropEndIndex === -1) {\n return [];\n }\n\n return arr.slice(dropEndIndex);\n}\n","/**\n * Fills elements of an array with a specified value from the start position up to, but not including, the end position.\n *\n * This function mutates the original array and replaces its elements with the provided value, starting from the specified\n * start index up to the end index (non-inclusive). If the start or end indices are not provided, it defaults to filling the\n * entire array.\n *\n * @param {Array<T | U>} array - The array to fill.\n * @param {U} value - The value to fill the array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The array with the filled values.\n *\n * @example\n * const array = [1, 2, 3];\n * const result = fill(array, 'a');\n * // => ['a', 'a', 'a']\n *\n * const result = fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * const result = fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n *\n * const result = fill(array, '*', -2, -1);\n * // => [1, '*', 3]\n */\nexport function fill<T>(array: unknown[], value: T): T[];\nexport function fill<T, U>(array: Array<T | U>, value: U, start: number): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start: number, end: number): Array<T | U>;\nexport function fill<T, U>(array: Array<T | U>, value: U, start = 0, end = array.length): Array<T | U> {\n const length = array.length;\n const finalStart = Math.max(start >= 0 ? start : length + start, 0);\n const finalEnd = Math.min(end >= 0 ? end : length + end, length);\n\n for (let i = finalStart; i < finalEnd; i++) {\n array[i] = value;\n }\n\n return array;\n}\n","/**\n * Flattens an array up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<T[], D>>} A new array that has been flattened.\n *\n * @example\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1);\n * // Returns: [1, 2, 3, 4, [5, 6]]\n *\n * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flatten<T, D extends number = 1>(arr: readonly T[], depth = 1 as D): Array<FlatArray<T[], D>> {\n const result: Array<FlatArray<T[], D>> = [];\n const flooredDepth = Math.floor(depth);\n\n const recursive = (arr: readonly T[], currentDepth: number) => {\n for (const item of arr) {\n if (Array.isArray(item) && currentDepth < flooredDepth) {\n recursive(item, currentDepth + 1);\n } else {\n result.push(item as FlatArray<T[], D>);\n }\n }\n };\n\n recursive(arr, 0);\n return result;\n}\n","import { flatten } from './flatten.ts';\n\n/**\n * Maps each element in the array using the iteratee function and flattens the result up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template U - The type of elements within the returned array from the iteratee function.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {(item: T) => U} iteratee - The function that produces the new array elements.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<U[], D>>} The new array with the mapped and flattened elements.\n *\n * @example\n * const arr = [1, 2, 3];\n *\n * flatMap(arr, (item: number) => [item, item]);\n * // [1, 1, 2, 2, 3, 3]\n *\n * flatMap(arr, (item: number) => [[item, item]], 2);\n * // [1, 1, 2, 2, 3, 3]\n */\nexport function flatMap<T, U, D extends number>(\n arr: readonly T[],\n iteratee: (item: T) => U,\n depth = 1 as D\n): Array<FlatArray<U[], D>> {\n return flatten(arr.map(item => iteratee(item)), depth);\n}\n","import { flatten } from './flatten.ts';\n\n/**\n * Utility type for recursively unpacking nested array types to extract the type of the innermost element\n *\n * @example\n * ExtractNestedArrayType<(number | (number | number[])[])[]>\n * // number\n *\n * ExtractNestedArrayType<(boolean | (string | number[])[])[]>\n * // string | number | boolean\n */\ntype ExtractNestedArrayType<T> = T extends ReadonlyArray<infer U> ? ExtractNestedArrayType<U> : T;\n\n/**\n * Flattens all depths of a nested array.\n *\n * @template T - The type of elements within the array.\n * @param {T[]} arr - The array to flatten.\n * @returns {Array<ExtractNestedArrayType<T>>} A new array that has been flattened.\n *\n * @example\n * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flattenDeep<T>(arr: readonly T[]): Array<ExtractNestedArrayType<T>> {\n return flatten(arr, Infinity) as Array<ExtractNestedArrayType<T>>;\n}\n","/**\n * Iterates over elements of 'arr' from right to left and invokes 'callback' for each element.\n * \n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to iterate over.\n * @param {(value: T, index: number, arr: T[]) => void} callback - The function invoked per iteration.\n * The callback function receives three arguments:\n * - 'value': The current element being processed in the array.\n * - 'index': The index of the current element being processed in the array.\n * - 'arr': The array 'forEachRight' was called upon.\n * \n * @example\n * const array = [1, 2, 3];\n * const result: number[] = [];\n * \n * // Use the forEachRight function to iterate through the array and add each element to the result array.\n * forEachRight(array, (value) => {\n * result.push(value);\n * })\n * \n * console.log(result) // Output: [3, 2, 1]\n */\n\nexport function forEachRight<T>(arr: T[], callback: (value: T, index: number, arr: T[]) => void): void {\n for (let i = arr.length - 1; i >= 0; i--) {\n const element = arr[i];\n callback(element, i, arr);\n }\n}\n","/**\n * Groups the elements of an array based on a provided key-generating function.\n *\n * This function takes an array and a function that generates a key from each element. It returns\n * an object where the keys are the generated keys and the values are arrays of elements that share\n * the same key.\n *\n * @template T - The type of elements in the array.\n * @template K - The type of keys.\n * @param {T[]} arr - The array to group.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T[]>} An object where each key is associated with an array of elements that\n * share that key.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = groupBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: [\n * // { category: 'fruit', name: 'apple' },\n * // { category: 'fruit', name: 'banana' }\n * // ],\n * // vegetable: [\n * // { category: 'vegetable', name: 'carrot' }\n * // ]\n * // }\n */\nexport function groupBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T[]> {\n const result = {} as Record<K, T[]>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n\n if (result[key] == null) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n","/**\n * Returns the intersection of two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements that are\n * present in both arrays. It effectively filters out any elements from the first array that\n * are not found in the second array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @returns {T[]} A new array containing the elements that are present in both arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n */\nexport function intersection<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => {\n return secondSet.has(item);\n });\n}\n","/**\n * Returns the intersection of two arrays based on a mapping function.\n *\n * This function takes two arrays and a mapping function. It returns a new array containing\n * the elements from the first array that, when mapped using the provided function, have matching\n * mapped elements in the second array. It effectively filters out any elements from the first array\n * that do not have corresponding mapped values in the second array.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(item: T) => U} mapper - A function to map the elements of both arrays for comparison.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding mapped values in the second array.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const mapper = item => item.id;\n * const result = intersectionBy(array1, array2, mapper);\n * // result will be [{ id: 2 }] since only this element has a matching id in both arrays.\n */\nexport function intersectionBy<T, U>(firstArr: readonly T[], secondArr: readonly T[], mapper: (item: T) => U): T[] {\n const mappedSecondSet = new Set(secondArr.map(mapper));\n return firstArr.filter(item => mappedSecondSet.has(mapper(item)));\n}\n","/**\n * Returns the intersection of two arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function. It returns a new array containing\n * the elements from the first array that have matching elements in the second array, as determined\n * by the custom equality function. It effectively filters out any elements from the first array that\n * do not have corresponding matches in the second array according to the equality function.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @param {(x: T, y: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * This function takes two arguments, one from each array, and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array containing the elements from the first array that have corresponding matches in the second array according to the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];\n * const array2 = [{ id: 2 }, { id: 4 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = intersectionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 2 }] since this element has a matching id in both arrays.\n */\nexport function intersectionWith<T>(\n firstArr: readonly T[],\n secondArr: readonly T[],\n areItemsEqual: (x: T, y: T) => boolean\n): T[] {\n return firstArr.filter(firstItem => {\n return secondArr.some(secondItem => {\n return areItemsEqual(firstItem, secondItem);\n });\n });\n}\n","/**\n * Maps each element of an array based on a provided key-generating function.\n *\n * This function takes an array and a function that generates a key from each element. It returns\n * an object where the keys are the generated keys and the values are the corresponding elements.\n * If there are multiple elements generating the same key, the last element among them is used\n * as the value.\n *\n * @template T - The type of elements in the array.\n * @template K - The type of keys.\n * @param {T[]} arr - The array of elements to be mapped.\n * @param {(item: T) => K} getKeyFromItem - A function that generates a key from an element.\n * @returns {Record<K, T>} An object where keys are mapped to each element of an array.\n *\n * @example\n * const array = [\n * { category: 'fruit', name: 'apple' },\n * { category: 'fruit', name: 'banana' },\n * { category: 'vegetable', name: 'carrot' }\n * ];\n * const result = keyBy(array, item => item.category);\n * // result will be:\n * // {\n * // fruit: { category: 'fruit', name: 'banana' },\n * // vegetable: { category: 'vegetable', name: 'carrot' }\n * // }\n */\nexport function keyBy<T, K extends PropertyKey>(arr: readonly T[], getKeyFromItem: (item: T) => K): Record<K, T> {\n const result = {} as Record<K, T>;\n\n for (const item of arr) {\n const key = getKeyFromItem(item);\n result[key] = item;\n }\n\n return result;\n}\n","/**\n * Finds the element in an array that has the maximum value when applying\n * the `getValue` function to each element.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {T} The element with the maximum value as determined by the `getValue` function.\n * @example\n * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }\n * maxBy([], x => x.a); // Returns: undefined\n */\nexport function maxBy<T>(items: T[], getValue: (element: T) => number): T {\n let maxElement = items[0];\n let max = -Infinity;\n\n for (const element of items) {\n const value = getValue(element);\n if (value > max) {\n max = value;\n maxElement = element;\n }\n }\n\n return maxElement;\n}\n","/**\n * Finds the element in an array that has the minimum value when applying\n * the `getValue` function to each element.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} items The array of elements to search.\n * @param {(element: T) => number} getValue A function that selects a numeric value from each element.\n * @returns {T} The element with the minimum value as determined by the `getValue` function.\n * @example\n * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }\n * minBy([], x => x.a); // Returns: undefined\n */\nexport function minBy<T>(items: T[], getValue: (element: T) => number): T {\n let minElement = items[0];\n let min = Infinity;\n\n for (const element of items) {\n const value = getValue(element);\n if (value < min) {\n min = value;\n minElement = element;\n }\n }\n\n return minElement;\n}\n","type Order = 'asc' | 'desc';\n\n/**\n * Sorts an array of objects based on multiple properties and their corresponding order directions.\n *\n * This function takes an array of objects, an array of keys to sort by, and an array of order directions.\n * It returns the sorted array, ordering by each key according to its corresponding direction\n * ('asc' for ascending or 'desc' for descending). If values for a key are equal,\n * it moves to the next key to determine the order.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} collection - The array of objects to be sorted.\n * @param {Array<keyof T>} keys - An array of keys (properties) by which to sort.\n * @param {Order[]} orders - An array of order directions ('asc' for ascending or 'desc' for descending).\n * @returns {T[]} - The sorted array.\n *\n * @example\n * // Sort an array of objects by 'user' in ascending order and 'age' in descending order.\n * const users = [\n * { user: 'fred', age: 48 },\n * { user: 'barney', age: 34 },\n * { user: 'fred', age: 40 },\n * { user: 'barney', age: 36 },\n * ];\n * const result = orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // result will be:\n * // [\n * // { user: 'barney', age: 36 },\n * // { user: 'barney', age: 34 },\n * // { user: 'fred', age: 48 },\n * // { user: 'fred', age: 40 },\n * // ]\n */\nexport function orderBy<T>(collection: T[], keys: Array<keyof T>, orders: Order[]): T[] {\n const compareValues = (a: T[keyof T], b: T[keyof T], order: Order) => {\n if (a < b) {\n return order === 'asc' ? -1 : 1;\n }\n if (a > b) {\n return order === 'asc' ? 1 : -1;\n }\n return 0;\n };\n\n const effectiveOrders = keys.map((_, index) => orders[index] || orders[orders.length - 1]);\n\n return collection.slice().sort((a, b) => {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const order = effectiveOrders[i];\n const result = compareValues(a[key], b[key], order);\n if (result !== 0) {\n return result;\n }\n }\n return 0;\n });\n}\n","/**\n * Splits an array into two groups based on a predicate function.\n *\n * This function takes an array and a predicate function. It returns a tuple of two arrays:\n * the first array contains elements for which the predicate function returns true, and\n * the second array contains elements for which the predicate function returns false.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to partition.\n * @param {(value: T) => boolean} isInTruthy - A predicate function that determines\n * whether an element should be placed in the truthy array. The function is called with each\n * element of the array.\n * @returns {[T[], T[]]} A tuple containing two arrays: the first array contains elements for\n * which the predicate returned true, and the second array contains elements for which the\n * predicate returned false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const isEven = x => x % 2 === 0;\n * const [even, odd] = partition(array, isEven);\n * // even will be [2, 4], and odd will be [1, 3, 5]\n */\nexport function partition<T>(arr: readonly T[], isInTruthy: (value: T) => boolean): [truthy: T[], falsy: T[]] {\n const truthy: T[] = [];\n const falsy: T[] = [];\n\n for (const item of arr) {\n if (isInTruthy(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n\n return [truthy, falsy];\n}\n","/**\n * Returns a random element from an array.\n *\n * This function takes an array and returns a single element selected randomly from the array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to sample from.\n * @returns {T} A random element from the array.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const randomElement = sample(array);\n * // randomElement will be one of the elements from the array, selected randomly.\n */\nexport function sample<T>(arr: readonly T[]): T {\n const randomIndex = Math.floor(Math.random() * arr.length);\n return arr[randomIndex];\n}\n","/**\n * Generate a random number within the given range.\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result1 = random(0, 5); // Returns a random number between 0 and 5.\n * const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown\n * const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.\n */\nexport function random(maximum: number): number;\nexport function random(minimum: number, maximum: number): number;\nexport function random(minimum: number, maximum?: number): number {\n if (maximum == null) {\n maximum = minimum;\n minimum = 0;\n }\n\n if (minimum >= maximum) {\n throw new Error('Invalid input: The maximum value must be greater than the minimum value.');\n }\n\n return Math.random() * (maximum - minimum) + minimum;\n}\n","import { random } from './random.ts';\n\n/**\n * Generates a random integer between minimum (inclusive) and maximum (exclusive).\n *\n * If only one argument is provided, a number between `0` and the given number is returned.\n *\n * @param {number} minimum - The lower bound (inclusive).\n * @param {number} maximum - The upper bound (exclusive).\n * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).\n * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.\n *\n * @example\n * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)\n * const result2 = randomInt(5, 0); // This will throw an error\n */\nexport function randomInt(maximum: number): number;\nexport function randomInt(minimum: number, maximum: number): number;\nexport function randomInt(minimum: number, maximum?: number): number {\n return Math.floor(random(minimum, maximum!));\n}\n","import { randomInt } from '../math/randomInt.ts';\n\n/**\n * Returns a sample element array of a specified `size`.\n *\n * This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm.\n *\n * {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algoritm}\n *\n * @template T - The type of elements in the array.\n * @param {T[]} array - The array to sample from.\n * @param {number} size - The size of sample.\n * @returns {T[]} A new array with sample size applied.\n * @throws {Error} Throws an error if `size` is greater than the length of `array`.\n *\n * @example\n * const result = sampleSize([1, 2, 3], 2)\n * // result will be an array containing two of the elements from the array.\n * // [1, 2] or [1, 3] or [2, 3]\n */\nexport function sampleSize<T>(array: readonly T[], size: number): T[] {\n if (size > array.length) {\n throw new Error('Size must be less than or equal to the length of array.');\n }\n\n const result = new Array(size);\n const selected = new Set();\n\n for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {\n let index = randomInt(0, step + 1);\n\n if (selected.has(index)) {\n index = step;\n }\n\n selected.add(index);\n\n result[resultIndex] = array[index];\n }\n\n return result;\n}\n","/**\n * Randomizes the order of elements in an array using the Fisher-Yates algorithm.\n *\n * This function takes an array and returns a new array with its elements shuffled in a random order.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to shuffle.\n * @returns {T[]} A new array with its elements shuffled in random order.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const shuffledArray = shuffle(array);\n * // shuffledArray will be a new array with elements of array in random order, e.g., [3, 1, 4, 5, 2]\n */\nexport function shuffle<T>(arr: readonly T[]): T[] {\n const result = arr.slice();\n\n /**\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n for (let i = result.length - 1; i >= 1; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n","/**\n * Returns a new array containing the first `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the first `count` elements from `arr`.\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3, 4, 5], 3);\n *\n * @example\n * // Returns ['a', 'b']\n * take(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * take([1, 2, 3], 5);\n */\nexport function take<T>(arr: readonly T[], count: number): T[] {\n return arr.slice(0, count);\n}\n","/**\n * Returns a new array containing the last `count` elements from the input array `arr`.\n * If `count` is greater than the length of `arr`, the entire array is returned.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to take elements from.\n * @param {number} count - The number of elements to take.\n * @returns {T[]} A new array containing the last `count` elements from `arr`.\n *\n * @example\n * // Returns [4, 5]\n * takeRight([1, 2, 3, 4, 5], 2);\n *\n * @example\n * // Returns ['b', 'c']\n * takeRight(['a', 'b', 'c'], 2);\n *\n * @example\n * // Returns [1, 2, 3]\n * takeRight([1, 2, 3], 5);\n */\nexport function takeRight<T>(arr: readonly T[], count: number): T[] {\n if (count === 0) {\n return [];\n }\n\n return arr.slice(-count);\n}\n","/**\n * Takes elements from the end of the array while the predicate function returns `true`.\n *\n * @template T - Type of elements in the input array.\n *\n * @param {T[]} arr - The array to take elements from.\n * @param {function(T): boolean} shouldContinueTaking - The function invoked per element.\n * @returns {T[]} A new array containing the elements taken from the end while the predicate returns `true`.\n *\n * @example\n * // Returns [3, 2, 1]\n * takeRightWhile([5, 4, 3, 2, 1], n => n < 4);\n *\n * @example\n * // Returns []\n * takeRightWhile([1, 2, 3], n => n > 3);\n */\nexport function takeRightWhile<T>(arr: readonly T[], shouldContinueTaking: (item: T) => boolean): T[] {\n for (let i = arr.length - 1; i >= 0; i--) {\n if (!shouldContinueTaking(arr[i])) {\n return arr.slice(i + 1);\n }\n }\n\n return arr.slice();\n}\n","/**\n * Returns a new array containing the leading elements of the provided array\n * that satisfy the provided predicate function. It stops taking elements as soon\n * as an element does not satisfy the predicate.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @param {(element: T) => boolean} shouldContinueTaking - The predicate function that is called with each element. Elements are included in the result as long as this function returns true.\n * @returns {T[]} A new array containing the leading elements that satisfy the predicate.\n *\n * @example\n * // Returns [1, 2]\n * takeWhile([1, 2, 3, 4], x => x < 3);\n *\n * @example\n * // Returns []\n * takeWhile([1, 2, 3, 4], x => x > 3);\n */\nexport function takeWhile<T>(arr: readonly T[], shouldContinueTaking: (element: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n if (!shouldContinueTaking(item)) {\n break;\n }\n\n result.push(item);\n }\n\n return result;\n}\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","/**\n * Creates an array of unique values, in order, from all given arrays using a provided mapping function to determine equality.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item: T) => U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} A new array containing the union of unique elements from `arr1` and `arr2`, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for numbers (modulo comparison)\n * const moduloMapper = (x) => x % 3;\n * unionBy([1, 2, 3], [4, 5, 6], moduloMapper);\n * // Returns [1, 2, 3]\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = (obj) => obj.id;\n * unionBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 2 }, { id: 3 }]\n */\nexport function unionBy<T, U>(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of [...arr1, ...arr2]) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n","/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the comparator function.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - The function used to compare the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the comparator function.\n *\n * @example\n * ```ts\n * uniqWith([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], (a, b) => Math.abs(a - b) < 1);\n * // [1.2, 3.2, 5.7, 7.19]\n * ```\n */\nexport function uniqWith<T>(arr: readonly T[], areItemsEqual: (item1: T, item2: T) => boolean): T[] {\n const result: T[] = [];\n\n for (const item of arr) {\n const isUniq = result.every(v => !areItemsEqual(v, item));\n\n if (isUniq) {\n result.push(item);\n }\n }\n\n return result;\n}\n","import { uniqWith } from './uniqWith.ts';\n\n/**\n * Creates an array of unique values from two given arrays based on a custom equality function.\n *\n * This function takes two arrays and a custom equality function, merges the arrays, and returns\n * a new array containing only the unique values as determined by the custom equality function.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @param {(item1: T, item2: T) => boolean} areItemsEqual - A custom function to determine if two elements are equal.\n * It takes two arguments and returns `true` if the elements are considered equal, and `false` otherwise.\n * @returns {T[]} A new array of unique values based on the custom equality function.\n *\n * @example\n * const array1 = [{ id: 1 }, { id: 2 }];\n * const array2 = [{ id: 2 }, { id: 3 }];\n * const areItemsEqual = (a, b) => a.id === b.id;\n * const result = unionWith(array1, array2, areItemsEqual);\n * // result will be [{ id: 1 }, { id: 2 }, { id: 3 }] since { id: 2 } is considered equal in both arrays\n */\nexport function unionWith<T>(\n arr1: readonly T[],\n arr2: readonly T[],\n areItemsEqual: (item1: T, item2: T) => boolean\n): T[] {\n return uniqWith(arr1.concat(arr2), areItemsEqual);\n}\n","/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.2, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n","/**\n * Gathers elements in the same position in an internal array \n * from a grouped array of elements and returns them as a new array.\n *\n * @param zipped - The nested array to unzip.\n * @returns A new array of unzipped elements.\n *\n * @example\n * const zipped = [['a', true, 1],['b', false, 2]];\n * const result = unzip(zipped);\n * // result will be [['a', 'b'], [true, false], [1, 2]]\n */\nexport function unzip<T extends unknown[]>(zipped: Array<[...T]>): Unzip<T> {\n // For performance reasons, use this implementation instead of\n // const maxLen = Math.max(...zipped.map(arr => arr.length));\n let maxLen = 0;\n\n for (let i = 0; i < zipped.length; i++) {\n if (zipped[i].length > maxLen) {\n maxLen = zipped[i].length;\n }\n }\n\n const result = new Array(maxLen) as Unzip<T>;\n\n for (let i = 0; i < maxLen; i++) {\n result[i] = new Array(zipped.length);\n for (let j = 0; j < zipped.length; j++) {\n result[i][j] = zipped[j][i];\n }\n }\n\n return result;\n}\n\ntype Unzip<K extends unknown[]> = { [I in keyof K]: Array<K[I]> };\n","/**\n * Unzips an array of arrays, applying an `iteratee` function to regrouped elements.\n *\n * @template T, R\n * @param {T[][]} target - The nested array to unzip. This is an array of arrays,\n * where each inner array contains elements to be unzipped.\n * @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.\n * @returns {R[]} A new array of unzipped and transformed elements. \n *\n * @example\n * const nestedArray = [[1, 2], [3, 4], [5, 6]];\n * const result = unzipWith(nestedArray, (item, item2, item3) => item + item2 + item3);\n * // result will be [9, 12]\n */\nexport function unzipWith<T, R>(target: readonly T[][], iteratee: (...args: T[]) => R): R[] {\n const maxLength = Math.max(...target.map(innerArray => innerArray.length));\n const result: R[] = new Array(maxLength);\n\n for (let i = 0; i < maxLength; i++) {\n const group = new Array(target.length);\n\n for (let j = 0; j < target.length; j++) {\n group[j] = target[j][i];\n }\n\n result[i] = iteratee(...group);\n }\n\n return result;\n}\n","import { difference } from './difference.ts';\nimport { intersection } from './intersection.ts';\nimport { union } from './union.ts';\n\n/**\n * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements\n * which are in either of the arrays, but not in their intersection.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.\n *\n * @example\n * // Returns [1, 2, 5, 6]\n * xor([1, 2, 3, 4], [3, 4, 5, 6]);\n *\n * @example\n * // Returns ['a', 'c']\n * xor(['a', 'b'], ['b', 'c']);\n */\nexport function xor<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return difference(union(arr1, arr2), intersection(arr1, arr2));\n}\n","import { differenceBy } from './differenceBy.ts';\nimport { intersectionBy } from './intersectionBy.ts';\nimport { unionBy } from './unionBy.ts';\n\n/**\n * Computes the symmetric difference between two arrays using a custom mapping function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection, determined by the result of the mapping function.\n *\n * @template T - Type of elements in the input arrays.\n * @template U - Type of the values returned by the mapping function.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item: T) => U} mapper - The function to map array elements to comparison values.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.\n *\n * @example\n * // Custom mapping function for objects with an 'id' property\n * const idMapper = obj => obj.id;\n * xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorBy<T, U>(arr1: readonly T[], arr2: readonly T[], mapper: (item: T) => U): T[] {\n const union = unionBy(arr1, arr2, mapper);\n const intersection = intersectionBy(arr1, arr2, mapper);\n\n return differenceBy(union, intersection, mapper);\n}\n","import { differenceWith } from './differenceWith.ts';\nimport { intersectionWith } from './intersectionWith.ts';\nimport { unionWith } from './unionWith.ts';\n\n/**\n * Computes the symmetric difference between two arrays using a custom equality function.\n * The symmetric difference is the set of elements which are in either of the arrays,\n * but not in their intersection.\n *\n * @template T - Type of elements in the input arrays.\n *\n * @param {T[]} arr1 - The first array.\n * @param {T[]} arr2 - The second array.\n * @param {(item1: T, item2: T) => boolean} areElementsEqual - The custom equality function to compare elements.\n * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the custom equality function.\n *\n * @example\n * // Custom equality function for objects with an 'id' property\n * const areObjectsEqual = (a, b) => a.id === b.id;\n * xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], areObjectsEqual);\n * // Returns [{ id: 1 }, { id: 3 }]\n */\nexport function xorWith<T>(\n arr1: readonly T[],\n arr2: readonly T[],\n areElementsEqual: (item1: T, item2: T) => boolean\n): T[] {\n const union = unionWith(arr1, arr2, areElementsEqual);\n const intersection = intersectionWith(arr1, arr2, areElementsEqual);\n\n return differenceWith(union, intersection, areElementsEqual);\n}\n","/**\n * Combines multiple arrays into a single array of tuples.\n *\n * This function takes multiple arrays and returns a new array where each element is a tuple\n * containing the corresponding elements from the input arrays. If the input arrays are of\n * different lengths, the resulting array will have the length of the longest input array,\n * with undefined values for missing elements.\n *\n * @param {...T[][]} arrs - The arrays to zip together.\n * @returns {T[][]} A new array of tuples containing the corresponding elements from the input arrays.\n *\n * @example\n * const arr1 = [1, 2, 3];\n * const arr2 = ['a', 'b', 'c'];\n * const result = zip(arr1, arr2);\n * // result will be [[1, 'a'], [2, 'b'], [3, 'c']]\n *\n * const arr3 = [true, false];\n * const result2 = zip(arr1, arr2, arr3);\n * // result2 will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]\n */\nexport function zip<T>(arr1: readonly T[]): Array<[T]>;\nexport function zip<T, U>(arr1: readonly T[], arr2: readonly U[]): Array<[T, U]>;\nexport function zip<T, U, V>(arr1: readonly T[], arr2: readonly U[], arr3: readonly V[]): Array<[T, U, V]>;\nexport function zip<T, U, V, W>(\n arr1: readonly T[],\n arr2: readonly U[],\n arr3: readonly V[],\n arr4: readonly W[]\n): Array<[T, U, V, W]>;\nexport function zip<T>(...arrs: Array<readonly T[]>): T[][] {\n const result: T[][] = [];\n\n const maxIndex = Math.max(...arrs.map(x => x.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const element: T[] = [];\n\n for (const arr of arrs) {\n element.push(arr[i]);\n }\n\n result.push(element);\n }\n\n return result;\n}\n","/**\n * Combines two arrays, one of property names and one of corresponding values, into a single object.\n *\n * This function takes two arrays: one containing property names and another containing corresponding values.\n * It returns a new object where the property names from the first array are keys, and the corresponding elements\n * from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will\n * have `undefined` as their values.\n *\n * @template P - The type of elements in the array.\n * @template V - The type of elements in the array.\n * @param {P[]} keys - An array of property names.\n * @param {V[]} values - An array of values corresponding to the property names.\n * @returns {{ [K in P]: V }} A new object composed of the given property names and values.\n *\n * @example\n * const keys = ['a', 'b', 'c'];\n * const values = [1, 2, 3];\n * const result = zipObject(keys, values);\n * // result will be { a: 1, b: 2, c: 3 }\n *\n * const keys2 = ['a', 'b', 'c'];\n * const values2 = [1, 2];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2, c: undefined }\n *\n * const keys2 = ['a', 'b'];\n * const values2 = [1, 2, 3];\n * const result2 = zipObject(keys2, values2);\n * // result2 will be { a: 1, b: 2 }\n */\nexport function zipObject<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n\n for (let i = 0; i < keys.length; i++) {\n result[keys[i]] = values[i];\n }\n\n return result;\n}\n","/**\n * Combines multiple arrays into a single array using a custom combiner function.\n *\n * This function takes multiple arrays and a combiner function, and returns a new array where each element\n * is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @param {T[]} arr1 - The first array to zip.\n * @param {U[]} [arr2] - The second array to zip (optional).\n * @param {V[]} [arr3] - The third array to zip (optional).\n * @param {W[]} [arr4] - The fourth array to zip (optional).\n * @param {(...items: T[]) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value.\n * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.\n *\n * @example\n * // Example usage with two arrays:\n * const arr1 = [1, 2, 3];\n * const arr2 = [4, 5, 6];\n * const result = zipWith(arr1, arr2, (a, b) => a + b);\n * // result will be [5, 7, 9]\n *\n * @example\n * // Example usage with three arrays:\n * const arr1 = [1, 2];\n * const arr2 = [3, 4];\n * const arr3 = [5, 6];\n * const result = zipWith(arr1, arr2, arr3, (a, b, c) => `${a}${b}${c}`);\n * // result will be [`135`, `246`]\n */\nexport function zipWith<T, R>(arr1: readonly T[], combine: (item: T) => R): R[];\nexport function zipWith<T, U, R>(arr1: readonly T[], arr2: readonly U[], combine: (item1: T, item2: U) => R): R[];\nexport function zipWith<T, U, V, R>(\n arr1: readonly T[],\n arr2: readonly U[],\n arr3: readonly V[],\n combine: (item1: T, item2: U, item3: V) => R\n): R[];\nexport function zipWith<T, U, V, W, R>(\n arr1: readonly T[],\n arr2: readonly U[],\n arr3: readonly V[],\n arr4: readonly W[],\n combine: (item1: T, item2: U, item3: V, item4: W) => R\n): R[];\nexport function zipWith<T, R>(arr1: readonly T[], ...rest: any[]): R[] {\n const arrs = [arr1, ...rest.slice(0, -1)];\n const combine = rest[rest.length - 1] as (...items: T[]) => R;\n\n const result: R[] = [];\n const maxIndex = Math.max(...arrs.map(arr => arr.length));\n\n for (let i = 0; i < maxIndex; i++) {\n const elements: T[] = arrs.map(arr => arr[i]);\n result.push(combine(...elements));\n }\n\n return result;\n}\n","/**\n * Creates an array that excludes all specified values.\n *\n * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).\n *\n * @template T The type of elements in the array.\n * @param {T[]} array - The array to filter.\n * @param {...T[]} values - The values to exclude.\n * @returns {T[]} A new array without the specified values.\n *\n * @example\n * // Removes the specified values from the array\n * without([1, 2, 3, 4, 5], 2, 4);\n * // Returns: [1, 3, 5]\n *\n * @example\n * // Removes specified string values from the array\n * without(['a', 'b', 'c', 'a'], 'a');\n * // Returns: ['b', 'c']\n */\nexport function without<T>(array: readonly T[], ...values: T[]): T[] {\n const valuesSet = new Set(values);\n return array.filter(item => !valuesSet.has(item));\n}\n","/**\n * Returns the first element of an array.\n *\n * This function takes an array and returns the first element of the array.\n * If the array is empty, the function returns `undefined`.\n *\n * @param {T[]} arr - The array from which to get the first element.\n * @returns {T | undefined} The first element of the array, or `undefined` if the array is empty.\n *\n * @example\n * const arr = [1, 2, 3];\n * const firstElement = head(arr);\n * // firstElement will be 1\n *\n * const emptyArr: number[] = [];\n * const noElement = head(emptyArr);\n * // noElement will be undefined\n */\nexport function head<T>(arr: readonly [T, ...T[]]): T;\nexport function head<T>(arr: readonly T[]): T | undefined;\nexport function head<T>(arr: readonly T[]): T | undefined {\n return arr[0];\n}\n","/**\n * Returns an empty array when the input is a single-element array.\n *\n * @param {readonly [T]} arr - The single-element array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [1];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail<T>(arr: readonly [T]): [];\n\n/**\n * Returns an empty array when the input is an empty array.\n *\n * @param {readonly []} arr - The empty array to process.\n * @returns {[]} An empty array.\n *\n * @example\n * const arr = [];\n * const result = tail(arr);\n * // result will be []\n */\nexport function tail(arr: readonly []): [];\n\n/**\n * Returns a new array with all elements except for the first when the input is a tuple array.\n *\n * @param {readonly [T, ...U[]]} arr - The tuple array to process.\n * @returns {U[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr = [1, 2, 3];\n * const result = tail(arr);\n * // result will be [2, 3]\n */\nexport function tail<T, U>(arr: readonly [T, ...U[]]): U[];\n\n/**\n * Returns a new array with all elements except for the first.\n *\n * This function takes an array and returns a new array containing all the elements\n * except for the first one. If the input array is empty or has only one element,\n * an empty array is returned.\n *\n * @param {readonly T[]} arr - The array to get the tail of.\n * @returns {T[]} A new array containing all elements of the input array except for the first one.\n *\n * @example\n * const arr1 = [1, 2, 3];\n * const result = tail(arr1);\n * // result will be [2, 3]\n *\n * const arr2 = [1];\n * const result2 = tail(arr2);\n * // result2 will be []\n *\n * const arr3 = [];\n * const result3 = tail(arr3);\n * // result3 will be []\n */\nexport function tail<T>(arr: readonly T[]): T[];\n\nexport function tail<T>(arr: readonly T[]): T[] {\n const len = arr.length;\n if (len <= 1) {\n return [];\n }\n const result = new Array(len - 1);\n for (let i = 1; i < len; i++) {\n result[i - 1] = arr[i];\n }\n return result;\n}\n","/**\n * Creates a new array filled with the specified value from the start position up to, but not including, the end position.\n * This function does not mutate the original array.\n *\n * @param {Array<T>} arr - The array to base the new array on.\n * @param {U} value - The value to fill the new array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The new array with the filled values.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * let result = toFilled(array, '*', 2);\n * console.log(result); // [1, 2, '*', '*', '*']\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*', 1, 4);\n * console.log(result); // [1, '*', '*', '*', 5]\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*');\n * console.log(result); // ['*', '*', '*', '*', '*']\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*', -4, -1);\n * console.log(result); // [1, '*', '*', '*', 5]\n * console.log(array); // [1, 2, 3, 4, 5]\n */\n\nexport function toFilled<T, U>(arr: T[], value: U): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start: number): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start: number, end: number): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start = 0, end = arr.length): Array<T | U> {\n const length = arr.length;\n const finalStart = Math.max(start >= 0 ? start : length + start, 0);\n const finalEnd = Math.min(end >= 0 ? end : length + end, length);\n\n const newArr: Array<T | U> = arr.slice();\n\n for (let i = finalStart; i < finalEnd; i++) {\n newArr[i] = value;\n }\n\n return newArr;\n}\n","/**\n * Returns the last element of an array.\n *\n * This function takes an array and returns the last element of the array.\n * If the array is empty, the function returns `undefined`.\n *\n * Unlike some implementations, this function is optimized for performance\n * by directly accessing the last index of the array.\n *\n * @param {T[]} arr - The array from which to get the last element.\n * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty.\n *\n * @example\n * const arr = [1, 2, 3];\n * const lastElement = last(arr);\n * // lastElement will be 3\n *\n * const emptyArr: number[] = [];\n * const noElement = last(emptyArr);\n * // noElement will be undefined\n */\n\nexport function last<T>(arr: readonly [...T[], T]): T;\nexport function last<T>(arr: readonly T[]): T | undefined;\nexport function last<T>(arr: readonly T[]): T | undefined {\n return arr[arr.length - 1];\n}\n","/**\n * Returns a new array containing all elements except the last one from the input array.\n * If the input array is empty or has only one element, the function returns an empty array.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The input array to query.\n * @returns {T[]} A new array containing all but the last element of the input array.\n *\n * @example\n * const arr = [1, 2, 3, 4];\n * const newArr = initial(arr);\n * // newArr will be [1, 2, 3]\n *\n * @example\n * const emptyArr: number[] = [];\n * const newEmptyArr = initial(emptyArr);\n * // newEmptyArr will be []\n *\n * @example\n * const singleElementArr = ['only one'];\n * const newSingleElementArr = initial(singleElementArr);\n * // newSingleElementArr will be []\n */\nexport function initial<T>(arr: T[]): T[] {\n if (arr.length <= 1) {\n return [];\n }\n return arr.slice(0, -1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuBO,SAAS,MAAS,KAAmB,MAAqB;AAC/D,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,QAAQ,GAAG;AACxC,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,QAAM,cAAc,KAAK,KAAK,IAAI,SAAS,IAAI;AAC/C,QAAM,SAAgB,MAAM,WAAW;AAEvC,WAAS,QAAQ,GAAG,QAAQ,aAAa,SAAS;AAChD,UAAM,QAAQ,QAAQ;AACtB,UAAM,MAAM,QAAQ;AAEpB,WAAO,KAAK,IAAI,IAAI,MAAM,OAAO,GAAG;AAAA,EACtC;AAEA,SAAO;AACT;;;AC1BO,SAAS,QAAW,KAAwC;AACjE,QAAM,SAA8B,CAAC;AAErC,aAAW,QAAQ,KAAK;AACtB,QAAI,MAAM;AACR,aAAO,KAAK,IAAoB;AAAA,IAClC;AAAA,EACF;AAEA,SAAO;AACT;;;ACNO,SAAS,QAAW,KAAU,QAAqD;AAjB1F;AAkBE,QAAM,SAAiC,CAAC;AAExC,aAAW,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AAQ,GAAG,QAAQ,CAAC;AAAA,EAClC;AAEA,SAAO;AACT;;;ACpCO,SAAS,QAAW,UAAwB,QAAkB;AACnE,QAAM,YAAY,IAAI,IAAI,MAAM;AAChC,SAAO,MAAM,OAAO,UAAQ,CAAC,UAAU,IAAI,IAAI,CAAC;AAClD;;;ACHO,SAAS,KAAQ,KAAkC;AACxD,SAAO,IAAI,CAAC;AACd;;;AC0CO,SAAS,KAAQ,KAAwB;AAC9C,QAAM,MAAM,IAAI;AAChB,MAAI,OAAO,GAAG;AACZ,WAAO,CAAC;AAAA,EACV;AACA,QAAM,SAAS,IAAI,MAAM,MAAM,CAAC;AAChC,WAAS,IAAI,GAAG,IAAI,KAAK,KAAK;AAC5B,WAAO,IAAI,CAAC,IAAI,IAAI,CAAC;AAAA,EACvB;AACA,SAAO;AACT;;;AC1CO,SAAS,SAAe,KAAU,OAAU,QAAQ,GAAG,MAAM,IAAI,QAAsB;AAC5F,QAAM,SAAS,IAAI;AACnB,QAAM,aAAa,KAAK,IAAI,SAAS,IAAI,QAAQ,SAAS,OAAO,CAAC;AAClE,QAAM,WAAW,KAAK,IAAI,OAAO,IAAI,MAAM,SAAS,KAAK,MAAM;AAE/D,QAAM,SAAuB,IAAI,MAAM;AAEvC,WAAS,IAAI,YAAY,IAAI,UAAU,KAAK;AAC1C,WAAO,CAAC,IAAI;AAAA,EACd;AAEA,SAAO;AACT;;;ACpBO,SAAS,KAAQ,KAAkC;AACxD,SAAO,IAAI,IAAI,SAAS,CAAC;AAC3B;;;ACHO,SAAS,QAAW,KAAe;AACxC,MAAI,IAAI,UAAU,GAAG;AACnB,WAAO,CAAC;AAAA,EACV;AACA,SAAO,IAAI,MAAM,GAAG,EAAE;AACxB;","names":["arr","union","intersection","union","intersection"]}
|
package/dist/array/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/array/initial.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/initial.ts
|
|
21
|
-
var initial_exports = {};
|
|
22
|
-
__export(initial_exports, {
|
|
23
|
-
initial: () => initial
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(initial_exports);
|
|
26
|
-
function initial(arr) {
|
|
27
|
-
if (arr.length <= 1) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
return arr.slice(0, -1);
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
initial
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=initial.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/initial.ts"],"sourcesContent":["/**\n * Returns a new array containing all elements except the last one from the input array.\n * If the input array is empty or has only one element, the function returns an empty array.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The input array to query.\n * @returns {T[]} A new array containing all but the last element of the input array.\n *\n * @example\n * const arr = [1, 2, 3, 4];\n * const newArr = initial(arr);\n * // newArr will be [1, 2, 3]\n *\n * @example\n * const emptyArr: number[] = [];\n * const newEmptyArr = initial(emptyArr);\n * // newEmptyArr will be []\n *\n * @example\n * const singleElementArr = ['only one'];\n * const newSingleElementArr = initial(singleElementArr);\n * // newSingleElementArr will be []\n */\nexport function initial<T>(arr: T[]): T[] {\n if (arr.length <= 1) {\n return [];\n }\n return arr.slice(0, -1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,QAAW,KAAe;AACxC,MAAI,IAAI,UAAU,GAAG;AACnB,WAAO,CAAC;AAAA,EACV;AACA,SAAO,IAAI,MAAM,GAAG,EAAE;AACxB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/array/intersection.ts
|
|
21
|
-
var intersection_exports = {};
|
|
22
|
-
__export(intersection_exports, {
|
|
23
|
-
intersection: () => intersection
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(intersection_exports);
|
|
26
|
-
function intersection(firstArr, secondArr) {
|
|
27
|
-
const secondSet = new Set(secondArr);
|
|
28
|
-
return firstArr.filter((item) => {
|
|
29
|
-
return secondSet.has(item);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
intersection
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=intersection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/array/intersection.ts"],"sourcesContent":["/**\n * Returns the intersection of two arrays.\n *\n * This function takes two arrays and returns a new array containing the elements that are\n * present in both arrays. It effectively filters out any elements from the first array that\n * are not found in the second array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} firstArr - The first array to compare.\n * @param {T[]} secondArr - The second array to compare.\n * @returns {T[]} A new array containing the elements that are present in both arrays.\n *\n * @example\n * const array1 = [1, 2, 3, 4, 5];\n * const array2 = [3, 4, 5, 6, 7];\n * const result = intersection(array1, array2);\n * // result will be [3, 4, 5] since these elements are in both arrays.\n */\nexport function intersection<T>(firstArr: readonly T[], secondArr: readonly T[]): T[] {\n const secondSet = new Set(secondArr);\n\n return firstArr.filter(item => {\n return secondSet.has(item);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,SAAS,aAAgB,UAAwB,WAA8B;AACpF,QAAM,YAAY,IAAI,IAAI,SAAS;AAEnC,SAAO,SAAS,OAAO,UAAQ;AAC7B,WAAO,UAAU,IAAI,IAAI;AAAA,EAC3B,CAAC;AACH;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|