es-toolkit 1.50.0 → 1.51.0-dev.2069
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/NOTICE +39 -0
- package/README.md +2 -2
- package/bigint.d.ts +1 -0
- package/bigint.js +1 -0
- package/dist/_internal/NonPlainObject.d.mts +8 -0
- package/dist/_internal/NonPlainObject.d.ts +8 -0
- package/dist/_internal/bigIntRangeLength.js +19 -0
- package/dist/_internal/bigIntRangeLength.mjs +19 -0
- package/dist/_internal/isMergeableValue.js +17 -0
- package/dist/_internal/isMergeableValue.mjs +17 -0
- package/dist/_internal/isUnsafeProperty.js +7 -4
- package/dist/_internal/isUnsafeProperty.mjs +7 -4
- package/dist/_internal/isUnsafeToWriteProperty.js +22 -0
- package/dist/_internal/isUnsafeToWriteProperty.mjs +22 -0
- package/dist/array/at.d.mts +1 -1
- package/dist/array/at.d.ts +1 -1
- package/dist/array/filterAsync.js +1 -1
- package/dist/array/filterAsync.mjs +1 -1
- package/dist/array/flatMapAsync.js +1 -1
- package/dist/array/flatMapAsync.mjs +1 -1
- package/dist/array/forEachAsync.js +1 -1
- package/dist/array/forEachAsync.mjs +1 -1
- package/dist/array/index.js +1 -1
- package/dist/array/index.mjs +1 -1
- package/dist/array/limitAsync.d.mts +4 -28
- package/dist/array/limitAsync.d.ts +4 -28
- package/dist/array/limitAsync.js +2 -39
- package/dist/array/limitAsync.mjs +3 -39
- package/dist/array/mapAsync.js +1 -1
- package/dist/array/mapAsync.mjs +1 -1
- package/dist/array/orderBy.d.mts +1 -1
- package/dist/array/orderBy.d.ts +1 -1
- package/dist/array/pullAt.d.mts +1 -1
- package/dist/array/pullAt.d.ts +1 -1
- package/dist/array/pullAt.js +1 -1
- package/dist/array/pullAt.mjs +1 -1
- package/dist/array/sortBy.d.mts +1 -1
- package/dist/array/sortBy.d.ts +1 -1
- package/dist/array/unzip.d.mts +3 -0
- package/dist/array/unzip.d.ts +3 -0
- package/dist/array/unzip.js +3 -0
- package/dist/array/unzip.mjs +3 -0
- package/dist/bigint/clamp.d.mts +37 -0
- package/dist/bigint/clamp.d.ts +37 -0
- package/dist/bigint/clamp.js +16 -0
- package/dist/bigint/clamp.mjs +16 -0
- package/dist/bigint/inRange.d.mts +37 -0
- package/dist/bigint/inRange.d.ts +37 -0
- package/dist/bigint/inRange.js +20 -0
- package/dist/bigint/inRange.mjs +20 -0
- package/dist/bigint/index.d.mts +14 -0
- package/dist/bigint/index.d.ts +14 -0
- package/dist/bigint/index.js +27 -0
- package/dist/bigint/index.mjs +14 -0
- package/dist/bigint/max.d.mts +21 -0
- package/dist/bigint/max.d.ts +21 -0
- package/dist/bigint/max.js +26 -0
- package/dist/bigint/max.mjs +26 -0
- package/dist/bigint/maxBy.d.mts +21 -0
- package/dist/bigint/maxBy.d.ts +21 -0
- package/dist/bigint/maxBy.js +34 -0
- package/dist/bigint/maxBy.mjs +34 -0
- package/dist/bigint/median.d.mts +22 -0
- package/dist/bigint/median.d.ts +22 -0
- package/dist/bigint/median.js +28 -0
- package/dist/bigint/median.mjs +28 -0
- package/dist/bigint/medianBy.d.mts +21 -0
- package/dist/bigint/medianBy.d.ts +21 -0
- package/dist/bigint/medianBy.js +24 -0
- package/dist/bigint/medianBy.mjs +24 -0
- package/dist/bigint/min.d.mts +18 -0
- package/dist/bigint/min.d.ts +18 -0
- package/dist/bigint/min.js +23 -0
- package/dist/bigint/min.mjs +23 -0
- package/dist/bigint/minBy.d.mts +21 -0
- package/dist/bigint/minBy.d.ts +21 -0
- package/dist/bigint/minBy.js +34 -0
- package/dist/bigint/minBy.mjs +34 -0
- package/dist/bigint/percentile.d.mts +23 -0
- package/dist/bigint/percentile.d.ts +23 -0
- package/dist/bigint/percentile.js +31 -0
- package/dist/bigint/percentile.mjs +31 -0
- package/dist/bigint/range.d.mts +45 -0
- package/dist/bigint/range.d.ts +45 -0
- package/dist/bigint/range.js +24 -0
- package/dist/bigint/range.mjs +24 -0
- package/dist/bigint/rangeRight.d.mts +43 -0
- package/dist/bigint/rangeRight.d.ts +43 -0
- package/dist/bigint/rangeRight.js +25 -0
- package/dist/bigint/rangeRight.mjs +25 -0
- package/dist/bigint/sum.d.mts +18 -0
- package/dist/bigint/sum.d.ts +18 -0
- package/dist/bigint/sum.js +22 -0
- package/dist/bigint/sum.mjs +22 -0
- package/dist/bigint/sumBy.d.mts +20 -0
- package/dist/bigint/sumBy.d.ts +20 -0
- package/dist/bigint/sumBy.js +24 -0
- package/dist/bigint/sumBy.mjs +24 -0
- package/dist/browser.global.js +6 -3
- package/dist/compat/_internal/normalizeZero.js +13 -0
- package/dist/compat/_internal/normalizeZero.mjs +13 -0
- package/dist/compat/_internal/toKey.js +1 -1
- package/dist/compat/_internal/toKey.mjs +1 -1
- package/dist/compat/_internal/unicodeSize.js +45 -0
- package/dist/compat/_internal/unicodeSize.mjs +45 -0
- package/dist/compat/array/chunk.js +1 -0
- package/dist/compat/array/chunk.mjs +1 -0
- package/dist/compat/array/difference.js +2 -1
- package/dist/compat/array/difference.mjs +2 -1
- package/dist/compat/array/differenceBy.js +3 -2
- package/dist/compat/array/differenceBy.mjs +3 -2
- package/dist/compat/array/drop.d.mts +1 -1
- package/dist/compat/array/drop.d.ts +1 -1
- package/dist/compat/array/dropRight.d.mts +2 -3
- package/dist/compat/array/dropRight.d.ts +2 -3
- package/dist/compat/array/dropRight.js +4 -4
- package/dist/compat/array/dropRight.mjs +4 -4
- package/dist/compat/array/every.js +9 -9
- package/dist/compat/array/every.mjs +9 -9
- package/dist/compat/array/fill.js +8 -2
- package/dist/compat/array/fill.mjs +8 -2
- package/dist/compat/array/find.js +14 -13
- package/dist/compat/array/find.mjs +14 -13
- package/dist/compat/array/findIndex.js +3 -19
- package/dist/compat/array/findIndex.mjs +3 -19
- package/dist/compat/array/findLast.js +3 -3
- package/dist/compat/array/findLast.mjs +3 -3
- package/dist/compat/array/flatMap.js +3 -8
- package/dist/compat/array/flatMap.mjs +3 -7
- package/dist/compat/array/flatMapDepth.js +1 -1
- package/dist/compat/array/flatMapDepth.mjs +1 -1
- package/dist/compat/array/forEach.js +1 -1
- package/dist/compat/array/forEach.mjs +1 -1
- package/dist/compat/array/includes.js +13 -13
- package/dist/compat/array/includes.mjs +13 -13
- package/dist/compat/array/indexOf.js +2 -1
- package/dist/compat/array/indexOf.mjs +2 -1
- package/dist/compat/array/intersection.js +3 -2
- package/dist/compat/array/intersection.mjs +3 -2
- package/dist/compat/array/intersectionBy.js +7 -11
- package/dist/compat/array/intersectionBy.mjs +7 -11
- package/dist/compat/array/intersectionWith.js +6 -18
- package/dist/compat/array/intersectionWith.mjs +6 -18
- package/dist/compat/array/last.js +1 -1
- package/dist/compat/array/last.mjs +1 -1
- package/dist/compat/array/lastIndexOf.js +3 -1
- package/dist/compat/array/lastIndexOf.mjs +3 -1
- package/dist/compat/array/map.js +3 -3
- package/dist/compat/array/map.mjs +3 -3
- package/dist/compat/array/orderBy.js +8 -6
- package/dist/compat/array/orderBy.mjs +8 -6
- package/dist/compat/array/partition.js +6 -6
- package/dist/compat/array/partition.mjs +6 -6
- package/dist/compat/array/pull.js +1 -1
- package/dist/compat/array/pull.mjs +1 -1
- package/dist/compat/array/pullAll.js +2 -0
- package/dist/compat/array/pullAll.mjs +2 -0
- package/dist/compat/array/remove.js +8 -4
- package/dist/compat/array/remove.mjs +8 -4
- package/dist/compat/array/reverse.js +1 -1
- package/dist/compat/array/reverse.mjs +1 -1
- package/dist/compat/array/sampleSize.js +2 -1
- package/dist/compat/array/sampleSize.mjs +2 -1
- package/dist/compat/array/size.js +2 -1
- package/dist/compat/array/size.mjs +2 -1
- package/dist/compat/array/some.js +2 -1
- package/dist/compat/array/some.mjs +2 -1
- package/dist/compat/array/takeRightWhile.js +2 -2
- package/dist/compat/array/takeRightWhile.mjs +2 -2
- package/dist/compat/array/takeWhile.js +2 -2
- package/dist/compat/array/takeWhile.mjs +2 -2
- package/dist/compat/array/unionBy.js +2 -1
- package/dist/compat/array/unionBy.mjs +2 -1
- package/dist/compat/array/uniqBy.js +4 -3
- package/dist/compat/array/uniqBy.mjs +4 -3
- package/dist/compat/array/unzip.d.mts +3 -0
- package/dist/compat/array/unzip.d.ts +3 -0
- package/dist/compat/array/unzip.js +3 -0
- package/dist/compat/array/unzip.mjs +3 -0
- package/dist/compat/array/unzipWith.js +1 -1
- package/dist/compat/array/unzipWith.mjs +1 -1
- package/dist/compat/array/zipObject.js +2 -0
- package/dist/compat/array/zipObject.mjs +2 -0
- package/dist/compat/compat.d.mts +3 -3
- package/dist/compat/compat.d.ts +3 -3
- package/dist/compat/compat.js +8 -4
- package/dist/compat/compat.mjs +8 -4
- package/dist/compat/function/curry.d.mts +1 -1
- package/dist/compat/function/curry.d.ts +1 -1
- package/dist/compat/function/debounce.js +1 -1
- package/dist/compat/function/debounce.mjs +1 -1
- package/dist/compat/function/flowRight.d.mts +1 -1
- package/dist/compat/function/flowRight.d.ts +1 -1
- package/dist/compat/function/partial.d.mts +1 -1
- package/dist/compat/function/partial.d.ts +1 -1
- package/dist/compat/function/rest.d.mts +1 -1
- package/dist/compat/function/rest.d.ts +1 -1
- package/dist/compat/function/rest.js +1 -1
- package/dist/compat/function/rest.mjs +1 -1
- package/dist/compat/index.d.mts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +6 -4
- package/dist/compat/index.mjs +5 -5
- package/dist/compat/math/maxBy.js +1 -1
- package/dist/compat/math/maxBy.mjs +1 -1
- package/dist/compat/math/meanBy.d.mts +4 -0
- package/dist/compat/math/meanBy.d.ts +4 -0
- package/dist/compat/math/meanBy.js +8 -3
- package/dist/compat/math/meanBy.mjs +8 -3
- package/dist/compat/math/minBy.js +1 -1
- package/dist/compat/math/minBy.mjs +1 -1
- package/dist/compat/object/cloneDeep.d.mts +5 -5
- package/dist/compat/object/cloneDeep.d.ts +5 -5
- package/dist/compat/object/cloneDeep.js +5 -5
- package/dist/compat/object/cloneDeep.mjs +5 -5
- package/dist/compat/object/cloneDeepWith.js +3 -1
- package/dist/compat/object/cloneDeepWith.mjs +3 -1
- package/dist/compat/object/cloneWith.d.mts +1 -1
- package/dist/compat/object/cloneWith.d.ts +1 -1
- package/dist/compat/object/cloneWith.js +1 -1
- package/dist/compat/object/cloneWith.mjs +1 -1
- package/dist/compat/object/entries.d.mts +1 -0
- package/dist/compat/object/entries.d.ts +1 -0
- package/dist/compat/object/entries.js +1 -0
- package/dist/compat/object/entries.mjs +1 -0
- package/dist/compat/object/entriesIn.d.mts +1 -0
- package/dist/compat/object/entriesIn.d.ts +1 -0
- package/dist/compat/object/entriesIn.js +1 -0
- package/dist/compat/object/entriesIn.mjs +1 -0
- package/dist/compat/object/omit.js +5 -5
- package/dist/compat/object/omit.mjs +5 -5
- package/dist/compat/object/transform.js +1 -1
- package/dist/compat/object/transform.mjs +1 -1
- package/dist/compat/object/updateWith.js +2 -2
- package/dist/compat/object/updateWith.mjs +2 -2
- package/dist/compat/predicate/isMatchWith.js +14 -5
- package/dist/compat/predicate/isMatchWith.mjs +14 -5
- package/dist/compat/string/template.js +2 -1
- package/dist/compat/string/template.mjs +2 -1
- package/dist/compat/string/words.js +17 -13
- package/dist/compat/string/words.mjs +17 -13
- package/dist/compat/util/iteratee.js +1 -3
- package/dist/compat/util/iteratee.mjs +1 -3
- package/dist/compat/util/toArray.d.mts +5 -5
- package/dist/compat/util/toArray.d.ts +5 -5
- package/dist/compat/util/toArray.js +9 -5
- package/dist/compat/util/toArray.mjs +9 -5
- package/dist/compat/util/toPath.js +11 -3
- package/dist/compat/util/toPath.mjs +11 -3
- package/dist/compat/util/toString.js +4 -1
- package/dist/compat/util/toString.mjs +4 -1
- package/dist/fp/array/at.d.mts +1 -1
- package/dist/fp/array/at.d.ts +1 -1
- package/dist/fp/array/orderBy.d.mts +1 -1
- package/dist/fp/array/orderBy.d.ts +1 -1
- package/dist/fp/array/sortBy.d.mts +1 -1
- package/dist/fp/array/sortBy.d.ts +1 -1
- package/dist/fp/array/unzip.d.mts +3 -0
- package/dist/fp/array/unzip.d.ts +3 -0
- package/dist/fp/array/unzip.js +3 -0
- package/dist/fp/array/unzip.mjs +3 -0
- package/dist/fp/iterator/chunk.d.mts +19 -0
- package/dist/fp/iterator/chunk.d.ts +19 -0
- package/dist/fp/iterator/chunk.js +24 -0
- package/dist/fp/iterator/chunk.mjs +24 -0
- package/dist/fp/iterator/count.d.mts +20 -0
- package/dist/fp/iterator/count.d.ts +20 -0
- package/dist/fp/iterator/count.js +25 -0
- package/dist/fp/iterator/count.mjs +25 -0
- package/dist/fp/iterator/drop.d.mts +20 -0
- package/dist/fp/iterator/drop.d.ts +20 -0
- package/dist/fp/iterator/drop.js +24 -0
- package/dist/fp/iterator/drop.mjs +24 -0
- package/dist/fp/iterator/dropWhile.d.mts +18 -0
- package/dist/fp/iterator/dropWhile.d.ts +18 -0
- package/dist/fp/iterator/dropWhile.js +23 -0
- package/dist/fp/iterator/dropWhile.mjs +23 -0
- package/dist/fp/iterator/every.d.mts +20 -0
- package/dist/fp/iterator/every.d.ts +20 -0
- package/dist/fp/iterator/every.js +24 -0
- package/dist/fp/iterator/every.mjs +24 -0
- package/dist/fp/iterator/filter.d.mts +37 -0
- package/dist/fp/iterator/filter.d.ts +37 -0
- package/dist/fp/iterator/filter.js +8 -0
- package/dist/fp/iterator/filter.mjs +8 -0
- package/dist/fp/iterator/find.d.mts +20 -0
- package/dist/fp/iterator/find.d.ts +20 -0
- package/dist/fp/iterator/find.js +24 -0
- package/dist/fp/iterator/find.mjs +24 -0
- package/dist/fp/iterator/flatMap.d.mts +20 -0
- package/dist/fp/iterator/flatMap.d.ts +20 -0
- package/dist/fp/iterator/flatMap.js +24 -0
- package/dist/fp/iterator/flatMap.mjs +24 -0
- package/dist/fp/iterator/forEach.d.mts +22 -0
- package/dist/fp/iterator/forEach.d.ts +22 -0
- package/dist/fp/iterator/forEach.js +26 -0
- package/dist/fp/iterator/forEach.mjs +26 -0
- package/dist/fp/iterator/head.d.mts +19 -0
- package/dist/fp/iterator/head.d.ts +19 -0
- package/dist/fp/iterator/head.js +24 -0
- package/dist/fp/iterator/head.mjs +24 -0
- package/dist/fp/iterator/index.d.mts +21 -0
- package/dist/fp/iterator/index.d.ts +21 -0
- package/dist/fp/iterator/index.js +41 -0
- package/dist/fp/iterator/index.mjs +21 -0
- package/dist/fp/iterator/map.d.mts +20 -0
- package/dist/fp/iterator/map.d.ts +20 -0
- package/dist/fp/iterator/map.js +24 -0
- package/dist/fp/iterator/map.mjs +24 -0
- package/dist/fp/iterator/partition.d.mts +22 -0
- package/dist/fp/iterator/partition.d.ts +22 -0
- package/dist/fp/iterator/partition.js +27 -0
- package/dist/fp/iterator/partition.mjs +27 -0
- package/dist/fp/iterator/reduce.d.mts +24 -0
- package/dist/fp/iterator/reduce.d.ts +24 -0
- package/dist/fp/iterator/reduce.js +28 -0
- package/dist/fp/iterator/reduce.mjs +28 -0
- package/dist/fp/iterator/scan.d.mts +21 -0
- package/dist/fp/iterator/scan.d.ts +21 -0
- package/dist/fp/iterator/scan.js +26 -0
- package/dist/fp/iterator/scan.mjs +26 -0
- package/dist/fp/iterator/some.d.mts +20 -0
- package/dist/fp/iterator/some.d.ts +20 -0
- package/dist/fp/iterator/some.js +24 -0
- package/dist/fp/iterator/some.mjs +24 -0
- package/dist/fp/iterator/take.d.mts +21 -0
- package/dist/fp/iterator/take.d.ts +21 -0
- package/dist/fp/iterator/take.js +25 -0
- package/dist/fp/iterator/take.mjs +25 -0
- package/dist/fp/iterator/takeWhile.d.mts +19 -0
- package/dist/fp/iterator/takeWhile.d.ts +19 -0
- package/dist/fp/iterator/takeWhile.js +24 -0
- package/dist/fp/iterator/takeWhile.mjs +24 -0
- package/dist/fp/iterator/toArray.d.mts +21 -0
- package/dist/fp/iterator/toArray.d.ts +21 -0
- package/dist/fp/iterator/toArray.js +25 -0
- package/dist/fp/iterator/toArray.mjs +25 -0
- package/dist/fp/iterator/uniqBy.d.mts +20 -0
- package/dist/fp/iterator/uniqBy.d.ts +20 -0
- package/dist/fp/iterator/uniqBy.js +25 -0
- package/dist/fp/iterator/uniqBy.mjs +25 -0
- package/dist/fp/iterator/zip.d.mts +20 -0
- package/dist/fp/iterator/zip.d.ts +20 -0
- package/dist/fp/iterator/zip.js +25 -0
- package/dist/fp/iterator/zip.mjs +25 -0
- package/dist/function/memoize.d.mts +3 -2
- package/dist/function/memoize.d.ts +3 -2
- package/dist/function/memoize.js +3 -2
- package/dist/function/memoize.mjs +3 -2
- package/dist/function/partial.d.mts +2 -2
- package/dist/function/partial.d.ts +2 -2
- package/dist/function/partialRight.d.mts +5 -5
- package/dist/function/partialRight.d.ts +5 -5
- package/dist/function/rest.d.mts +1 -1
- package/dist/function/rest.d.ts +1 -1
- package/dist/function/rest.js +1 -1
- package/dist/function/rest.mjs +1 -1
- package/dist/function/retry.d.mts +7 -4
- package/dist/function/retry.d.ts +7 -4
- package/dist/function/retry.js +4 -2
- package/dist/function/retry.mjs +1 -1
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +18 -4
- package/dist/index.mjs +12 -5
- package/dist/iterator/_internal/iterator.js +74 -0
- package/dist/iterator/_internal/iterator.mjs +74 -0
- package/dist/iterator/chunk.d.mts +21 -0
- package/dist/iterator/chunk.d.ts +21 -0
- package/dist/iterator/chunk.js +40 -0
- package/dist/iterator/chunk.mjs +40 -0
- package/dist/iterator/count.d.mts +18 -0
- package/dist/iterator/count.d.ts +18 -0
- package/dist/iterator/count.js +26 -0
- package/dist/iterator/count.mjs +26 -0
- package/dist/iterator/dropWhile.d.mts +20 -0
- package/dist/iterator/dropWhile.d.ts +20 -0
- package/dist/iterator/dropWhile.js +52 -0
- package/dist/iterator/dropWhile.mjs +52 -0
- package/dist/iterator/head.d.mts +21 -0
- package/dist/iterator/head.d.ts +21 -0
- package/dist/iterator/head.js +26 -0
- package/dist/iterator/head.mjs +26 -0
- package/dist/iterator/index.d.mts +12 -0
- package/dist/iterator/index.d.ts +12 -0
- package/dist/iterator/index.js +23 -0
- package/dist/iterator/index.mjs +12 -0
- package/dist/iterator/iterate.d.mts +20 -0
- package/dist/iterator/iterate.d.ts +20 -0
- package/dist/iterator/iterate.js +32 -0
- package/dist/iterator/iterate.mjs +32 -0
- package/dist/iterator/partition.d.mts +18 -0
- package/dist/iterator/partition.d.ts +18 -0
- package/dist/iterator/partition.js +36 -0
- package/dist/iterator/partition.mjs +36 -0
- package/dist/iterator/range.d.mts +42 -0
- package/dist/iterator/range.d.ts +42 -0
- package/dist/iterator/range.js +25 -0
- package/dist/iterator/range.mjs +25 -0
- package/dist/iterator/scan.d.mts +23 -0
- package/dist/iterator/scan.d.ts +23 -0
- package/dist/iterator/scan.js +47 -0
- package/dist/iterator/scan.mjs +47 -0
- package/dist/iterator/takeWhile.d.mts +20 -0
- package/dist/iterator/takeWhile.d.ts +20 -0
- package/dist/iterator/takeWhile.js +34 -0
- package/dist/iterator/takeWhile.mjs +34 -0
- package/dist/iterator/uniqBy.d.mts +22 -0
- package/dist/iterator/uniqBy.d.ts +22 -0
- package/dist/iterator/uniqBy.js +43 -0
- package/dist/iterator/uniqBy.mjs +43 -0
- package/dist/iterator/zip.d.mts +23 -0
- package/dist/iterator/zip.d.ts +23 -0
- package/dist/iterator/zip.js +45 -0
- package/dist/iterator/zip.mjs +45 -0
- package/dist/object/cloneDeepWith.d.mts +3 -1
- package/dist/object/cloneDeepWith.d.ts +3 -1
- package/dist/object/cloneDeepWith.js +3 -1
- package/dist/object/cloneDeepWith.mjs +3 -1
- package/dist/object/deepFreeze.d.mts +20 -0
- package/dist/object/deepFreeze.d.ts +20 -0
- package/dist/object/deepFreeze.js +29 -0
- package/dist/object/deepFreeze.mjs +29 -0
- package/dist/object/flattenObject.d.mts +16 -1
- package/dist/object/flattenObject.d.ts +16 -1
- package/dist/object/flattenObject.js +15 -6
- package/dist/object/flattenObject.mjs +15 -6
- package/dist/object/index.d.mts +7 -1
- package/dist/object/index.d.ts +7 -1
- package/dist/object/index.js +12 -0
- package/dist/object/index.mjs +7 -1
- package/dist/object/mapKeysAsync.d.mts +25 -0
- package/dist/object/mapKeysAsync.d.ts +25 -0
- package/dist/object/mapKeysAsync.js +32 -0
- package/dist/object/mapKeysAsync.mjs +32 -0
- package/dist/object/mapValuesAsync.d.mts +26 -0
- package/dist/object/mapValuesAsync.d.ts +26 -0
- package/dist/object/mapValuesAsync.js +32 -0
- package/dist/object/mapValuesAsync.mjs +32 -0
- package/dist/object/merge.js +2 -4
- package/dist/object/merge.mjs +1 -3
- package/dist/object/mergeWith.js +4 -4
- package/dist/object/mergeWith.mjs +4 -4
- package/dist/object/toCamelCaseKeys.d.mts +2 -6
- package/dist/object/toCamelCaseKeys.d.ts +2 -6
- package/dist/object/toConstantCaseKeys.d.mts +52 -0
- package/dist/object/toConstantCaseKeys.d.ts +52 -0
- package/dist/object/toConstantCaseKeys.js +66 -0
- package/dist/object/toConstantCaseKeys.mjs +66 -0
- package/dist/object/toKebabCaseKeys.d.mts +52 -0
- package/dist/object/toKebabCaseKeys.d.ts +52 -0
- package/dist/object/toKebabCaseKeys.js +66 -0
- package/dist/object/toKebabCaseKeys.mjs +66 -0
- package/dist/object/toMerged.js +4 -4
- package/dist/object/toMerged.mjs +4 -4
- package/dist/object/toPascalCaseKeys.d.mts +52 -0
- package/dist/object/toPascalCaseKeys.d.ts +52 -0
- package/dist/object/toPascalCaseKeys.js +66 -0
- package/dist/object/toPascalCaseKeys.mjs +66 -0
- package/dist/object/toSnakeCaseKeys.d.mts +2 -3
- package/dist/object/toSnakeCaseKeys.d.ts +2 -3
- package/dist/promise/index.d.mts +2 -1
- package/dist/promise/index.d.ts +2 -1
- package/dist/promise/index.js +2 -0
- package/dist/promise/index.mjs +2 -1
- package/dist/promise/limitAsync.d.mts +35 -0
- package/dist/promise/limitAsync.d.ts +35 -0
- package/dist/promise/limitAsync.js +46 -0
- package/dist/promise/limitAsync.mjs +46 -0
- package/dist/string/dedent.d.mts +37 -0
- package/dist/string/dedent.d.ts +37 -0
- package/dist/string/dedent.js +38 -0
- package/dist/string/dedent.mjs +38 -0
- package/dist/string/index.d.mts +2 -1
- package/dist/string/index.d.ts +2 -1
- package/dist/string/index.js +5 -3
- package/dist/string/index.mjs +5 -4
- package/dist/types/ToCamelCaseKeys.d.mts +24 -0
- package/dist/types/ToCamelCaseKeys.d.ts +24 -0
- package/dist/types/ToConstantCaseKeys.d.mts +21 -0
- package/dist/types/ToConstantCaseKeys.d.ts +21 -0
- package/dist/types/ToKebabCaseKeys.d.mts +23 -0
- package/dist/types/ToKebabCaseKeys.d.ts +23 -0
- package/dist/types/ToPascalCaseKeys.d.mts +24 -0
- package/dist/types/ToPascalCaseKeys.d.ts +24 -0
- package/dist/types/ToSnakeCaseKeys.d.mts +21 -0
- package/dist/types/ToSnakeCaseKeys.d.ts +21 -0
- package/dist/types/index.d.mts +6 -1
- package/dist/types/index.d.ts +6 -1
- package/fp/iterator.d.ts +1 -0
- package/fp/iterator.js +1 -0
- package/iterator.d.ts +1 -0
- package/iterator.js +1 -0
- package/package.json +70 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# es-toolkit Changelog
|
|
2
2
|
|
|
3
|
+
## Version v1.51.0
|
|
4
|
+
|
|
5
|
+
Released on August 17th, 2026.
|
|
6
|
+
|
|
7
|
+
- Added the `es-toolkit/bigint` entrypoint: `bigint` counterparts of the math
|
|
8
|
+
functions (`sum`, `sumBy`, `max`, `min`, `maxBy`, `minBy`, `clamp`, `inRange`,
|
|
9
|
+
`median`, `medianBy`, `percentile`, `range`, `rangeRight`), kept separate so
|
|
10
|
+
the `number` implementations stay unchanged. ([#1966])
|
|
11
|
+
- Added `dedent`, which removes common leading whitespace from template strings. ([#1679])
|
|
12
|
+
- Added `deepFreeze` for recursively freezing objects. ([#1680])
|
|
13
|
+
- Added `mapValuesAsync` and `mapKeysAsync`. ([#1544])
|
|
14
|
+
- Added `toPascalCaseKeys`, `toKebabCaseKeys`, and `toConstantCaseKeys`,
|
|
15
|
+
completing the object key casing family. ([#1984])
|
|
16
|
+
- Exported the `ToCamelCaseKeys`, `ToPascalCaseKeys`, `ToSnakeCaseKeys`,
|
|
17
|
+
`ToKebabCaseKeys`, and `ToConstantCaseKeys` types. ([#1651])
|
|
18
|
+
- Added a `preserveArrays` option to `flattenObject`. ([#974])
|
|
19
|
+
|
|
20
|
+
- Fixed `retry` to pass the last error to the `delay` callback ([#1759]) and to
|
|
21
|
+
throw the last attempt's error without applying a final delay ([#1901]).
|
|
22
|
+
- Fixed `mergeWith` and `toMerged` to handle mixed array/object types
|
|
23
|
+
consistently with `merge`. ([#2026])
|
|
24
|
+
- Fixed `pullAt` to remove the correct elements with negative indices. ([#1613])
|
|
25
|
+
- Fixed `at`, `pullAt`, `orderBy`, and `sortBy` to accept readonly arrays. ([#2016])
|
|
26
|
+
- Moved `limitAsync` from the array to the promise category. ([#2022])
|
|
27
|
+
- Included the NOTICE file in the published npm and JSR packages. ([#2020])
|
|
28
|
+
|
|
29
|
+
The following bring `es-toolkit/compat` closer to Lodash. Behavior for the affected
|
|
30
|
+
edge cases now matches Lodash, so results may differ if you relied on the previous output.
|
|
31
|
+
|
|
32
|
+
- Added `entries` and `entriesIn`. ([#1874])
|
|
33
|
+
- Fixed `compat/isMatch` and `compat/isMatchWith` to handle object source
|
|
34
|
+
patterns against primitive and non-plain-object targets like Lodash. ([#1432])
|
|
35
|
+
- Fixed `compat/set` to block `constructor.prototype` paths, preventing
|
|
36
|
+
prototype pollution. ([#1904])
|
|
37
|
+
- Fixed `compat/find` to respect array-like `length` ([#1958]) and to convert
|
|
38
|
+
`fromIndex` to an integer ([#1961]), and `compat/indexOf` to convert
|
|
39
|
+
`fromIndex` to an integer when searching for `NaN` ([#1951]).
|
|
40
|
+
- Fixed `compat/orderBy` to resolve unresolved deep paths and nullish elements
|
|
41
|
+
to `undefined` ([#2010]), to exclude the `length` property from array-like
|
|
42
|
+
values ([#2002]), and to read the criterion property from primitive values ([#1903]).
|
|
43
|
+
- Fixed `compat/toPath` to split unquoted dotted keys inside brackets. ([#1899])
|
|
44
|
+
- Fixed `compat/omit` to treat a key array as a single deep path. ([#1902])
|
|
45
|
+
- Fixed `compat/map` to make the iteratee optional with an identity default. ([#1928])
|
|
46
|
+
- Fixed `compat/size` to count combined Unicode symbols as single characters. ([#1900])
|
|
47
|
+
- Fixed `compat/intersectionBy` to support number, object, and nullish iteratee
|
|
48
|
+
shorthands ([#1993]), and `compat/intersectionWith` to apply the comparator
|
|
49
|
+
when deduplicating the first array ([#1953]).
|
|
50
|
+
- Fixed `compat/difference`, `compat/differenceBy`, `compat/uniqBy`, and
|
|
51
|
+
`compat/unionBy` to normalize `-0` to `0`. ([#2007])
|
|
52
|
+
- Fixed `compat/maxBy` and `compat/minBy` to skip nullish iteratee values ([#1927]),
|
|
53
|
+
and `compat/meanBy` to skip `undefined` values when averaging ([#1978]).
|
|
54
|
+
- Fixed `compat/some`, `compat/template` ([#2009]), and `compat/fill` ([#1952])
|
|
55
|
+
to gate guard handling with `isIterateeCall`.
|
|
56
|
+
- Fixed `compat/iteratee` to treat a boolean as a property shorthand. ([#1941])
|
|
57
|
+
- Fixed `compat/reverse` to support array-like objects and `arguments`. ([#2008])
|
|
58
|
+
- Fixed `compat/toArray` to convert non-array-like iterables. ([#1999])
|
|
59
|
+
- Fixed `compat/toString` to render nested nullish values like Lodash. ([#1992])
|
|
60
|
+
- Fixed `compat/zipObject` to treat `null` keys and values as empty arrays. ([#2005])
|
|
61
|
+
- Fixed `compat/sampleSize` to clamp the default size to the collection length. ([#2003])
|
|
62
|
+
- Fixed `compat/takeWhile`, `compat/takeRightWhile`, and `compat/uniqBy` to
|
|
63
|
+
support string inputs. ([#2004])
|
|
64
|
+
- Fixed `compat/chunk` to return an empty array for an empty collection with an
|
|
65
|
+
`Infinity` size. ([#1995])
|
|
66
|
+
- Fixed `compat/lastIndexOf` to read holes in sparse arrays as `undefined`. ([#1977])
|
|
67
|
+
- Fixed `compat/last` to return `undefined` for empty array-like inputs. ([#1954])
|
|
68
|
+
- Fixed `compat/pullAll` to return the array as-is when `values` is nullish. ([#1962])
|
|
69
|
+
|
|
70
|
+
- Added a browser compatibility test suite. ([#2012])
|
|
71
|
+
- Improved documentation, JSDoc accuracy, tests, and internal refactoring across
|
|
72
|
+
`compat` and the docs site. ([#1622], [#1789], [#1824], [#1844], [#1849],
|
|
73
|
+
[#1854], [#1855], [#1859], [#1860], [#1868], [#1871], [#1887], [#1898],
|
|
74
|
+
[#1933], [#1939], [#1947], [#1950], [#1955], [#1956], [#1957], [#1960],
|
|
75
|
+
[#1963], [#1964], [#1968], [#1969], [#1970], [#1972], [#1979], [#1985],
|
|
76
|
+
[#2000], [#2001], [#2021], [#2025], [#2027])
|
|
77
|
+
|
|
78
|
+
We sincerely thank @Antoliny0919, @D-Sketon, @kojesung, @chuenchen309,
|
|
79
|
+
@mariazuheros, @DongEun02, @raon0211, @sukvvon, @racgoo, @dayongkr, @Kropiunig,
|
|
80
|
+
@ssi02014, @sarathfrancis90, @mym0404, @mlnwns, @kdelay, @gwagjiug, @dohwi,
|
|
81
|
+
@blro0319, @benedictleejh, @amir-rezaei, @ianzone, @sen2y, @rossyman,
|
|
82
|
+
@eunwoo-levi, @ramong26, @Gdm0714, and everyone else who contributed.
|
|
83
|
+
We appreciate your great efforts!
|
|
84
|
+
|
|
3
85
|
## Version v1.50.0
|
|
4
86
|
|
|
5
87
|
Released on July 24th, 2026.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
es-toolkit
|
|
2
|
+
|
|
3
|
+
Parts of the test suite and compatibility layer in es-toolkit/compat are
|
|
4
|
+
derived from Lodash (https://github.com/lodash/lodash).
|
|
5
|
+
|
|
6
|
+
Lodash copyright notice and MIT permission notice:
|
|
7
|
+
|
|
8
|
+
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
9
|
+
|
|
10
|
+
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
11
|
+
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
12
|
+
|
|
13
|
+
This software consists of voluntary contributions made by many
|
|
14
|
+
individuals. For exact contribution history, see the revision history
|
|
15
|
+
available at https://github.com/lodash/lodash
|
|
16
|
+
|
|
17
|
+
The following license applies to all parts of this software except as
|
|
18
|
+
documented below:
|
|
19
|
+
|
|
20
|
+
====
|
|
21
|
+
|
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
23
|
+
a copy of this software and associated documentation files (the
|
|
24
|
+
"Software"), to deal in the Software without restriction, including
|
|
25
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
26
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
27
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
28
|
+
the following conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be
|
|
31
|
+
included in all copies or substantial portions of the Software.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
34
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
35
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
36
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
37
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
38
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
39
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ es-toolkit is a state-of-the-art, high-performance JavaScript utility library wi
|
|
|
9
9
|
- es-toolkit offers a variety of everyday utility functions with modern implementations, such as [debounce](https://es-toolkit.dev/reference/function/debounce.html), [delay](https://es-toolkit.dev/reference/promise/delay.html), [chunk](https://es-toolkit.dev/reference/array/chunk.html), [sum](https://es-toolkit.dev/reference/math/sum.html), and [pick](https://es-toolkit.dev/reference/object/pick.html).
|
|
10
10
|
- Designed with performance in mind, es-toolkit achieves [2-3× better performance](https://es-toolkit.dev/performance.html) in modern JavaScript environments.
|
|
11
11
|
- es-toolkit supports tree shaking out of the box, and [reduces JavaScript code by up to 97%](https://es-toolkit.dev/bundle-size.html) compared to other libraries.
|
|
12
|
-
- es-toolkit offers a complete compatibility layer to seamlessly replace
|
|
12
|
+
- es-toolkit offers a complete compatibility layer to seamlessly replace Lodash, available as [es-toolkit/compat](https://es-toolkit.dev/compatibility.html).
|
|
13
13
|
- es-toolkit includes built-in TypeScript support, with straightforward yet robust types. It also provides useful type guards such as [isNotNil](https://es-toolkit.dev/reference/predicate/isNotNil.html).
|
|
14
14
|
- es-toolkit is trusted and used by popular open-source projects like [Storybook](https://github.com/storybookjs/storybook/blob/9d862798d666678cc4822e857c00bbd744169ced/code/core/package.json#L358), [Recharts](https://github.com/recharts/recharts/blob/0fa4cc325da403b6fa1c6be0f820896ed92f806a/package.json#L94), [ink](https://github.com/vadimdemedes/ink/blob/2090ad9779be59dea71d173eb49785b7bd4495d0/package.json#L55), and [CKEditor](https://github.com/ckeditor/ckeditor5/blob/60d5fac804643cb4d359767ee2f94e3d92d1fcc5/packages/ckeditor5-core/package.json#L53).
|
|
15
15
|
- es-toolkit is battle-tested with 100% test coverage, ensuring reliability and robustness.
|
|
@@ -53,7 +53,7 @@ For more details, see the [AI Integration guide](https://es-toolkit.dev/ai-integ
|
|
|
53
53
|
|
|
54
54
|
## Contributing
|
|
55
55
|
|
|
56
|
-
We welcome
|
|
56
|
+
We welcome contributions from everyone in the community. Read below for a detailed contribution guide.
|
|
57
57
|
|
|
58
58
|
[CONTRIBUTING](https://github.com/toss/es-toolkit/blob/main/.github/CONTRIBUTING.md)
|
|
59
59
|
|
package/bigint.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/bigint';
|
package/bigint.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/bigint');
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/_internal/NonPlainObject.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in object types that key-conversion types like `ToCamelCaseKeys`
|
|
4
|
+
* leave unchanged instead of mapping over their properties.
|
|
5
|
+
*/
|
|
6
|
+
type NonPlainObject = Date | RegExp | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | Promise<any> | Error | ArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array | ((...args: any[]) => any) | typeof globalThis;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { NonPlainObject };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/_internal/NonPlainObject.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Built-in object types that key-conversion types like `ToCamelCaseKeys`
|
|
4
|
+
* leave unchanged instead of mapping over their properties.
|
|
5
|
+
*/
|
|
6
|
+
type NonPlainObject = Date | RegExp | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any> | Promise<any> | Error | ArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array | ((...args: any[]) => any) | typeof globalThis;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { NonPlainObject };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/_internal/bigIntRangeLength.ts
|
|
2
|
+
/**
|
|
3
|
+
* Calculates how many elements a bigint range from `start` (inclusive) to `end` (exclusive) contains.
|
|
4
|
+
*
|
|
5
|
+
* This mirrors `Math.ceil((end - start) / step)` from the `number` implementations, but performs the
|
|
6
|
+
* ceiling division with bigint arithmetic. Returns `0` when `step` points away from `end`.
|
|
7
|
+
*
|
|
8
|
+
* @param start - The start of the range.
|
|
9
|
+
* @param end - The end of the range.
|
|
10
|
+
* @param step - A non-zero step value.
|
|
11
|
+
* @returns The number of elements in the range.
|
|
12
|
+
*/
|
|
13
|
+
function bigIntRangeLength(start, end, step) {
|
|
14
|
+
const difference = end - start;
|
|
15
|
+
if (step > 0n) return difference <= 0n ? 0 : Number((difference + step - 1n) / step);
|
|
16
|
+
return difference >= 0n ? 0 : Number((difference + step + 1n) / step);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.bigIntRangeLength = bigIntRangeLength;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/_internal/bigIntRangeLength.ts
|
|
2
|
+
/**
|
|
3
|
+
* Calculates how many elements a bigint range from `start` (inclusive) to `end` (exclusive) contains.
|
|
4
|
+
*
|
|
5
|
+
* This mirrors `Math.ceil((end - start) / step)` from the `number` implementations, but performs the
|
|
6
|
+
* ceiling division with bigint arithmetic. Returns `0` when `step` points away from `end`.
|
|
7
|
+
*
|
|
8
|
+
* @param start - The start of the range.
|
|
9
|
+
* @param end - The end of the range.
|
|
10
|
+
* @param step - A non-zero step value.
|
|
11
|
+
* @returns The number of elements in the range.
|
|
12
|
+
*/
|
|
13
|
+
function bigIntRangeLength(start, end, step) {
|
|
14
|
+
const difference = end - start;
|
|
15
|
+
if (step > 0n) return difference <= 0n ? 0 : Number((difference + step - 1n) / step);
|
|
16
|
+
return difference >= 0n ? 0 : Number((difference + step + 1n) / step);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { bigIntRangeLength };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const require_isPlainObject = require("../predicate/isPlainObject.js");
|
|
2
|
+
//#region src/_internal/isMergeableValue.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a value can be deeply merged into, i.e. it is a plain object or an array.
|
|
5
|
+
*
|
|
6
|
+
* This function is used in `merge`, `mergeWith`, and `toMerged` to decide whether
|
|
7
|
+
* the source value should be merged into the existing target value recursively,
|
|
8
|
+
* preserving the target's structure, instead of replacing it.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to check.
|
|
11
|
+
* @returns `true` if the value is a plain object or an array, otherwise `false`.
|
|
12
|
+
*/
|
|
13
|
+
function isMergeableValue(value) {
|
|
14
|
+
return require_isPlainObject.isPlainObject(value) || Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.isMergeableValue = isMergeableValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isPlainObject } from "../predicate/isPlainObject.mjs";
|
|
2
|
+
//#region src/_internal/isMergeableValue.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a value can be deeply merged into, i.e. it is a plain object or an array.
|
|
5
|
+
*
|
|
6
|
+
* This function is used in `merge`, `mergeWith`, and `toMerged` to decide whether
|
|
7
|
+
* the source value should be merged into the existing target value recursively,
|
|
8
|
+
* preserving the target's structure, instead of replacing it.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to check.
|
|
11
|
+
* @returns `true` if the value is a plain object or an array, otherwise `false`.
|
|
12
|
+
*/
|
|
13
|
+
function isMergeableValue(value) {
|
|
14
|
+
return isPlainObject(value) || Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isMergeableValue };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
//#region src/_internal/isUnsafeProperty.ts
|
|
2
2
|
/**
|
|
3
|
-
* Checks if a property key is unsafe to
|
|
3
|
+
* Checks if a property key is unsafe to access or copy directly.
|
|
4
4
|
*
|
|
5
|
-
* This function is used in functions like `merge` to prevent
|
|
6
|
-
* by identifying
|
|
5
|
+
* This function is used in functions like `get`, `unset`, and `merge` to prevent
|
|
6
|
+
* prototype pollution attacks by identifying `__proto__`, which modifies the object's
|
|
7
|
+
* prototype chain. `constructor` and `prototype` stay accessible here because lodash
|
|
8
|
+
* keeps reads of them unrestricted; write paths use `isUnsafeToWriteProperty` instead,
|
|
9
|
+
* which also blocks those keys.
|
|
7
10
|
*
|
|
8
11
|
* @param key - The property key to check
|
|
9
|
-
* @returns `true` if the property is unsafe to
|
|
12
|
+
* @returns `true` if the property is unsafe to access directly, `false` otherwise
|
|
10
13
|
* @internal
|
|
11
14
|
*/
|
|
12
15
|
function isUnsafeProperty(key) {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
//#region src/_internal/isUnsafeProperty.ts
|
|
2
2
|
/**
|
|
3
|
-
* Checks if a property key is unsafe to
|
|
3
|
+
* Checks if a property key is unsafe to access or copy directly.
|
|
4
4
|
*
|
|
5
|
-
* This function is used in functions like `merge` to prevent
|
|
6
|
-
* by identifying
|
|
5
|
+
* This function is used in functions like `get`, `unset`, and `merge` to prevent
|
|
6
|
+
* prototype pollution attacks by identifying `__proto__`, which modifies the object's
|
|
7
|
+
* prototype chain. `constructor` and `prototype` stay accessible here because lodash
|
|
8
|
+
* keeps reads of them unrestricted; write paths use `isUnsafeToWriteProperty` instead,
|
|
9
|
+
* which also blocks those keys.
|
|
7
10
|
*
|
|
8
11
|
* @param key - The property key to check
|
|
9
|
-
* @returns `true` if the property is unsafe to
|
|
12
|
+
* @returns `true` if the property is unsafe to access directly, `false` otherwise
|
|
10
13
|
* @internal
|
|
11
14
|
*/
|
|
12
15
|
function isUnsafeProperty(key) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/_internal/isUnsafeToWriteProperty.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a property key is unsafe to write to.
|
|
4
|
+
*
|
|
5
|
+
* Writing through `__proto__`, `constructor`, or `prototype` can reach
|
|
6
|
+
* `Object.prototype` and pollute every object, so write paths like `set`,
|
|
7
|
+
* `update`, and `zipObjectDeep` abort when a path segment matches one of
|
|
8
|
+
* these keys, matching lodash's behavior.
|
|
9
|
+
*
|
|
10
|
+
* Read paths like `get` and `unset` use `isUnsafeProperty` instead, which
|
|
11
|
+
* only blocks `__proto__`; lodash keeps reads of `constructor` and
|
|
12
|
+
* `prototype` unrestricted.
|
|
13
|
+
*
|
|
14
|
+
* @param key - The property key to check
|
|
15
|
+
* @returns `true` if the property is unsafe to write to, `false` otherwise
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
function isUnsafeToWriteProperty(key) {
|
|
19
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.isUnsafeToWriteProperty = isUnsafeToWriteProperty;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/_internal/isUnsafeToWriteProperty.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a property key is unsafe to write to.
|
|
4
|
+
*
|
|
5
|
+
* Writing through `__proto__`, `constructor`, or `prototype` can reach
|
|
6
|
+
* `Object.prototype` and pollute every object, so write paths like `set`,
|
|
7
|
+
* `update`, and `zipObjectDeep` abort when a path segment matches one of
|
|
8
|
+
* these keys, matching lodash's behavior.
|
|
9
|
+
*
|
|
10
|
+
* Read paths like `get` and `unset` use `isUnsafeProperty` instead, which
|
|
11
|
+
* only blocks `__proto__`; lodash keeps reads of `constructor` and
|
|
12
|
+
* `prototype` unrestricted.
|
|
13
|
+
*
|
|
14
|
+
* @param key - The property key to check
|
|
15
|
+
* @returns `true` if the property is unsafe to write to, `false` otherwise
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
function isUnsafeToWriteProperty(key) {
|
|
19
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { isUnsafeToWriteProperty };
|
package/dist/array/at.d.mts
CHANGED
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* const result = at(numbers, [1, 3, 4]);
|
|
15
15
|
* console.log(result); // [20, 40, 50]
|
|
16
16
|
*/
|
|
17
|
-
declare function at<T>(arr: readonly T[], indices: number[]): T[];
|
|
17
|
+
declare function at<T>(arr: readonly T[], indices: readonly number[]): T[];
|
|
18
18
|
//#endregion
|
|
19
19
|
export { at };
|
package/dist/array/at.d.ts
CHANGED
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
* const result = at(numbers, [1, 3, 4]);
|
|
15
15
|
* console.log(result); // [20, 40, 50]
|
|
16
16
|
*/
|
|
17
|
-
declare function at<T>(arr: readonly T[], indices: number[]): T[];
|
|
17
|
+
declare function at<T>(arr: readonly T[], indices: readonly number[]): T[];
|
|
18
18
|
//#endregion
|
|
19
19
|
export { at };
|
package/dist/array/index.js
CHANGED
|
@@ -14,7 +14,6 @@ const require_dropRight = require("./dropRight.js");
|
|
|
14
14
|
const require_dropRightWhile = require("./dropRightWhile.js");
|
|
15
15
|
const require_dropWhile = require("./dropWhile.js");
|
|
16
16
|
const require_fill = require("./fill.js");
|
|
17
|
-
const require_limitAsync = require("./limitAsync.js");
|
|
18
17
|
const require_filterAsync = require("./filterAsync.js");
|
|
19
18
|
const require_flatten = require("./flatten.js");
|
|
20
19
|
const require_flatMap = require("./flatMap.js");
|
|
@@ -33,6 +32,7 @@ const require_isSubset = require("./isSubset.js");
|
|
|
33
32
|
const require_isSubsetWith = require("./isSubsetWith.js");
|
|
34
33
|
const require_keyBy = require("./keyBy.js");
|
|
35
34
|
const require_last = require("./last.js");
|
|
35
|
+
const require_limitAsync = require("./limitAsync.js");
|
|
36
36
|
const require_mapAsync = require("./mapAsync.js");
|
|
37
37
|
const require_maxBy = require("./maxBy.js");
|
|
38
38
|
const require_minBy = require("./minBy.js");
|
package/dist/array/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ import { dropRight } from "./dropRight.mjs";
|
|
|
13
13
|
import { dropRightWhile } from "./dropRightWhile.mjs";
|
|
14
14
|
import { dropWhile } from "./dropWhile.mjs";
|
|
15
15
|
import { fill } from "./fill.mjs";
|
|
16
|
-
import { limitAsync } from "./limitAsync.mjs";
|
|
17
16
|
import { filterAsync } from "./filterAsync.mjs";
|
|
18
17
|
import { flatten } from "./flatten.mjs";
|
|
19
18
|
import { flatMap } from "./flatMap.mjs";
|
|
@@ -32,6 +31,7 @@ import { isSubset } from "./isSubset.mjs";
|
|
|
32
31
|
import { isSubsetWith } from "./isSubsetWith.mjs";
|
|
33
32
|
import { keyBy } from "./keyBy.mjs";
|
|
34
33
|
import { last } from "./last.mjs";
|
|
34
|
+
import { limitAsync } from "./limitAsync.mjs";
|
|
35
35
|
import { mapAsync } from "./mapAsync.mjs";
|
|
36
36
|
import { maxBy } from "./maxBy.mjs";
|
|
37
37
|
import { minBy } from "./minBy.mjs";
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
+
import { limitAsync as limitAsync$1 } from "../promise/limitAsync.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/array/limitAsync.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Wraps an async function to limit the number of concurrent executions.
|
|
4
6
|
*
|
|
5
|
-
* This
|
|
6
|
-
* `concurrency` number of executions can run simultaneously. Additional calls will
|
|
7
|
-
* wait until a slot becomes available.
|
|
8
|
-
*
|
|
9
|
-
* @template F - The type of the async function to wrap.
|
|
10
|
-
* @param callback The async function to wrap with concurrency control.
|
|
11
|
-
* @param concurrency Maximum number of concurrent executions allowed.
|
|
12
|
-
* @returns A wrapped version of the callback with concurrency limiting.
|
|
13
|
-
* @example
|
|
14
|
-
* const limitedFetch = limitAsync(async (url) => {
|
|
15
|
-
* return await fetch(url);
|
|
16
|
-
* }, 3);
|
|
17
|
-
*
|
|
18
|
-
* // Only 3 fetches will run concurrently
|
|
19
|
-
* const urls = ['url1', 'url2', 'url3', 'url4', 'url5'];
|
|
20
|
-
* await Promise.all(urls.map(url => limitedFetch(url)));
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* const processItem = async (item) => {
|
|
24
|
-
* // Expensive async operation
|
|
25
|
-
* return await heavyComputation(item);
|
|
26
|
-
* };
|
|
27
|
-
*
|
|
28
|
-
* const limitedProcess = limitAsync(processItem, 2);
|
|
29
|
-
* const items = [1, 2, 3, 4, 5];
|
|
30
|
-
* // At most 2 items will be processed concurrently
|
|
31
|
-
* await Promise.all(items.map(item => limitedProcess(item)));
|
|
7
|
+
* @deprecated Use `limitAsync` from `es-toolkit/promise` instead. This export will be removed from `es-toolkit/array` in a future major version.
|
|
32
8
|
*/
|
|
33
|
-
declare
|
|
9
|
+
declare const limitAsync: typeof limitAsync$1;
|
|
34
10
|
//#endregion
|
|
35
11
|
export { limitAsync };
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
+
import { limitAsync as limitAsync$1 } from "../promise/limitAsync.js";
|
|
2
|
+
|
|
1
3
|
//#region src/array/limitAsync.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Wraps an async function to limit the number of concurrent executions.
|
|
4
6
|
*
|
|
5
|
-
* This
|
|
6
|
-
* `concurrency` number of executions can run simultaneously. Additional calls will
|
|
7
|
-
* wait until a slot becomes available.
|
|
8
|
-
*
|
|
9
|
-
* @template F - The type of the async function to wrap.
|
|
10
|
-
* @param callback The async function to wrap with concurrency control.
|
|
11
|
-
* @param concurrency Maximum number of concurrent executions allowed.
|
|
12
|
-
* @returns A wrapped version of the callback with concurrency limiting.
|
|
13
|
-
* @example
|
|
14
|
-
* const limitedFetch = limitAsync(async (url) => {
|
|
15
|
-
* return await fetch(url);
|
|
16
|
-
* }, 3);
|
|
17
|
-
*
|
|
18
|
-
* // Only 3 fetches will run concurrently
|
|
19
|
-
* const urls = ['url1', 'url2', 'url3', 'url4', 'url5'];
|
|
20
|
-
* await Promise.all(urls.map(url => limitedFetch(url)));
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* const processItem = async (item) => {
|
|
24
|
-
* // Expensive async operation
|
|
25
|
-
* return await heavyComputation(item);
|
|
26
|
-
* };
|
|
27
|
-
*
|
|
28
|
-
* const limitedProcess = limitAsync(processItem, 2);
|
|
29
|
-
* const items = [1, 2, 3, 4, 5];
|
|
30
|
-
* // At most 2 items will be processed concurrently
|
|
31
|
-
* await Promise.all(items.map(item => limitedProcess(item)));
|
|
7
|
+
* @deprecated Use `limitAsync` from `es-toolkit/promise` instead. This export will be removed from `es-toolkit/array` in a future major version.
|
|
32
8
|
*/
|
|
33
|
-
declare
|
|
9
|
+
declare const limitAsync: typeof limitAsync$1;
|
|
34
10
|
//#endregion
|
|
35
11
|
export { limitAsync };
|
package/dist/array/limitAsync.js
CHANGED
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
const require_semaphore = require("../promise/semaphore.js");
|
|
2
1
|
//#region src/array/limitAsync.ts
|
|
3
2
|
/**
|
|
4
3
|
* Wraps an async function to limit the number of concurrent executions.
|
|
5
4
|
*
|
|
6
|
-
* This
|
|
7
|
-
* `concurrency` number of executions can run simultaneously. Additional calls will
|
|
8
|
-
* wait until a slot becomes available.
|
|
9
|
-
*
|
|
10
|
-
* @template F - The type of the async function to wrap.
|
|
11
|
-
* @param callback The async function to wrap with concurrency control.
|
|
12
|
-
* @param concurrency Maximum number of concurrent executions allowed.
|
|
13
|
-
* @returns A wrapped version of the callback with concurrency limiting.
|
|
14
|
-
* @example
|
|
15
|
-
* const limitedFetch = limitAsync(async (url) => {
|
|
16
|
-
* return await fetch(url);
|
|
17
|
-
* }, 3);
|
|
18
|
-
*
|
|
19
|
-
* // Only 3 fetches will run concurrently
|
|
20
|
-
* const urls = ['url1', 'url2', 'url3', 'url4', 'url5'];
|
|
21
|
-
* await Promise.all(urls.map(url => limitedFetch(url)));
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const processItem = async (item) => {
|
|
25
|
-
* // Expensive async operation
|
|
26
|
-
* return await heavyComputation(item);
|
|
27
|
-
* };
|
|
28
|
-
*
|
|
29
|
-
* const limitedProcess = limitAsync(processItem, 2);
|
|
30
|
-
* const items = [1, 2, 3, 4, 5];
|
|
31
|
-
* // At most 2 items will be processed concurrently
|
|
32
|
-
* await Promise.all(items.map(item => limitedProcess(item)));
|
|
5
|
+
* @deprecated Use `limitAsync` from `es-toolkit/promise` instead. This export will be removed from `es-toolkit/array` in a future major version.
|
|
33
6
|
*/
|
|
34
|
-
|
|
35
|
-
const semaphore = new require_semaphore.Semaphore(concurrency);
|
|
36
|
-
return async function(...args) {
|
|
37
|
-
try {
|
|
38
|
-
await semaphore.acquire();
|
|
39
|
-
return await callback.apply(this, args);
|
|
40
|
-
} finally {
|
|
41
|
-
semaphore.release();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
7
|
+
const limitAsync = require("../promise/limitAsync.js").limitAsync;
|
|
45
8
|
//#endregion
|
|
46
9
|
exports.limitAsync = limitAsync;
|
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { limitAsync as limitAsync$1 } from "../promise/limitAsync.mjs";
|
|
2
2
|
//#region src/array/limitAsync.ts
|
|
3
3
|
/**
|
|
4
4
|
* Wraps an async function to limit the number of concurrent executions.
|
|
5
5
|
*
|
|
6
|
-
* This
|
|
7
|
-
* `concurrency` number of executions can run simultaneously. Additional calls will
|
|
8
|
-
* wait until a slot becomes available.
|
|
9
|
-
*
|
|
10
|
-
* @template F - The type of the async function to wrap.
|
|
11
|
-
* @param callback The async function to wrap with concurrency control.
|
|
12
|
-
* @param concurrency Maximum number of concurrent executions allowed.
|
|
13
|
-
* @returns A wrapped version of the callback with concurrency limiting.
|
|
14
|
-
* @example
|
|
15
|
-
* const limitedFetch = limitAsync(async (url) => {
|
|
16
|
-
* return await fetch(url);
|
|
17
|
-
* }, 3);
|
|
18
|
-
*
|
|
19
|
-
* // Only 3 fetches will run concurrently
|
|
20
|
-
* const urls = ['url1', 'url2', 'url3', 'url4', 'url5'];
|
|
21
|
-
* await Promise.all(urls.map(url => limitedFetch(url)));
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const processItem = async (item) => {
|
|
25
|
-
* // Expensive async operation
|
|
26
|
-
* return await heavyComputation(item);
|
|
27
|
-
* };
|
|
28
|
-
*
|
|
29
|
-
* const limitedProcess = limitAsync(processItem, 2);
|
|
30
|
-
* const items = [1, 2, 3, 4, 5];
|
|
31
|
-
* // At most 2 items will be processed concurrently
|
|
32
|
-
* await Promise.all(items.map(item => limitedProcess(item)));
|
|
6
|
+
* @deprecated Use `limitAsync` from `es-toolkit/promise` instead. This export will be removed from `es-toolkit/array` in a future major version.
|
|
33
7
|
*/
|
|
34
|
-
|
|
35
|
-
const semaphore = new Semaphore(concurrency);
|
|
36
|
-
return async function(...args) {
|
|
37
|
-
try {
|
|
38
|
-
await semaphore.acquire();
|
|
39
|
-
return await callback.apply(this, args);
|
|
40
|
-
} finally {
|
|
41
|
-
semaphore.release();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
8
|
+
const limitAsync = limitAsync$1;
|
|
45
9
|
//#endregion
|
|
46
10
|
export { limitAsync };
|
package/dist/array/mapAsync.js
CHANGED
package/dist/array/mapAsync.mjs
CHANGED
package/dist/array/orderBy.d.mts
CHANGED
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
* // { user: 'fred', age: 40 },
|
|
34
34
|
* // ]
|
|
35
35
|
*/
|
|
36
|
-
declare function orderBy<T extends object>(arr: readonly T[], criteria:
|
|
36
|
+
declare function orderBy<T extends object>(arr: readonly T[], criteria: ReadonlyArray<((item: T) => unknown) | keyof T>, orders: ReadonlyArray<'asc' | 'desc'>): T[];
|
|
37
37
|
//#endregion
|
|
38
38
|
export { orderBy };
|