@vielzeug/arsenal 2.1.0 → 26.10.0
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/README.md +5 -18
- package/dist/_common/_lruMap.cjs +1 -1
- package/dist/_common/_lruMap.cjs.map +1 -1
- package/dist/_common/_lruMap.js +1 -17
- package/dist/_common/_lruMap.js.map +1 -1
- package/dist/_common/_selectorSet.cjs +1 -1
- package/dist/_common/_selectorSet.cjs.map +1 -1
- package/dist/_common/_selectorSet.js +1 -15
- package/dist/_common/_selectorSet.js.map +1 -1
- package/dist/_common/unsafePaths.cjs +1 -1
- package/dist/_common/unsafePaths.cjs.map +1 -1
- package/dist/_common/unsafePaths.js +1 -12
- package/dist/_common/unsafePaths.js.map +1 -1
- package/dist/_dev.cjs +1 -1
- package/dist/_dev.cjs.map +1 -1
- package/dist/_dev.js +1 -5
- package/dist/_dev.js.map +1 -1
- package/dist/array/chunk.cjs +1 -1
- package/dist/array/chunk.cjs.map +1 -1
- package/dist/array/chunk.d.ts +1 -1
- package/dist/array/chunk.d.ts.map +1 -1
- package/dist/array/chunk.js +1 -9
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/compact.cjs +1 -1
- package/dist/array/compact.cjs.map +1 -1
- package/dist/array/compact.d.ts +1 -1
- package/dist/array/compact.d.ts.map +1 -1
- package/dist/array/compact.js +1 -7
- package/dist/array/compact.js.map +1 -1
- package/dist/array/compare.cjs +1 -1
- package/dist/array/compare.cjs.map +1 -1
- package/dist/array/compare.js +1 -18
- package/dist/array/compare.js.map +1 -1
- package/dist/array/compareBy.cjs +1 -1
- package/dist/array/compareBy.cjs.map +1 -1
- package/dist/array/compareBy.js +1 -15
- package/dist/array/compareBy.js.map +1 -1
- package/dist/array/contains.cjs +1 -1
- package/dist/array/contains.cjs.map +1 -1
- package/dist/array/contains.d.ts +1 -1
- package/dist/array/contains.d.ts.map +1 -1
- package/dist/array/contains.js +1 -8
- package/dist/array/contains.js.map +1 -1
- package/dist/array/countBy.cjs +1 -1
- package/dist/array/countBy.cjs.map +1 -1
- package/dist/array/countBy.d.ts +1 -1
- package/dist/array/countBy.d.ts.map +1 -1
- package/dist/array/countBy.js +1 -13
- package/dist/array/countBy.js.map +1 -1
- package/dist/array/difference.cjs +1 -1
- package/dist/array/difference.cjs.map +1 -1
- package/dist/array/difference.d.ts +4 -2
- package/dist/array/difference.d.ts.map +1 -1
- package/dist/array/difference.js +1 -13
- package/dist/array/difference.js.map +1 -1
- package/dist/array/drop.cjs +1 -1
- package/dist/array/drop.cjs.map +1 -1
- package/dist/array/drop.d.ts +1 -1
- package/dist/array/drop.d.ts.map +1 -1
- package/dist/array/drop.js +1 -8
- package/dist/array/drop.js.map +1 -1
- package/dist/array/dropLast.cjs +1 -1
- package/dist/array/dropLast.cjs.map +1 -1
- package/dist/array/dropLast.d.ts +1 -1
- package/dist/array/dropLast.d.ts.map +1 -1
- package/dist/array/dropLast.js +1 -8
- package/dist/array/dropLast.js.map +1 -1
- package/dist/array/filterMap.cjs +1 -1
- package/dist/array/filterMap.cjs.map +1 -1
- package/dist/array/filterMap.d.ts +3 -1
- package/dist/array/filterMap.d.ts.map +1 -1
- package/dist/array/filterMap.js +1 -12
- package/dist/array/filterMap.js.map +1 -1
- package/dist/array/first.cjs +1 -1
- package/dist/array/first.cjs.map +1 -1
- package/dist/array/first.d.ts +1 -1
- package/dist/array/first.d.ts.map +1 -1
- package/dist/array/first.js +1 -7
- package/dist/array/first.js.map +1 -1
- package/dist/array/groupBy.cjs +1 -1
- package/dist/array/groupBy.cjs.map +1 -1
- package/dist/array/groupBy.d.ts +1 -1
- package/dist/array/groupBy.d.ts.map +1 -1
- package/dist/array/groupBy.js +1 -13
- package/dist/array/groupBy.js.map +1 -1
- package/dist/array/index.cjs +1 -1
- package/dist/array/index.d.ts +0 -1
- package/dist/array/index.d.ts.map +1 -1
- package/dist/array/index.js +1 -29
- package/dist/array/indexBy.cjs +1 -1
- package/dist/array/indexBy.cjs.map +1 -1
- package/dist/array/indexBy.d.ts +1 -1
- package/dist/array/indexBy.d.ts.map +1 -1
- package/dist/array/indexBy.js +1 -13
- package/dist/array/indexBy.js.map +1 -1
- package/dist/array/intersection.cjs +1 -1
- package/dist/array/intersection.cjs.map +1 -1
- package/dist/array/intersection.d.ts +4 -2
- package/dist/array/intersection.d.ts.map +1 -1
- package/dist/array/intersection.js +1 -13
- package/dist/array/intersection.js.map +1 -1
- package/dist/array/last.cjs +1 -1
- package/dist/array/last.cjs.map +1 -1
- package/dist/array/last.d.ts +1 -1
- package/dist/array/last.d.ts.map +1 -1
- package/dist/array/last.js +1 -7
- package/dist/array/last.js.map +1 -1
- package/dist/array/partition.cjs +1 -1
- package/dist/array/partition.cjs.map +1 -1
- package/dist/array/partition.d.ts +3 -1
- package/dist/array/partition.d.ts.map +1 -1
- package/dist/array/partition.js +1 -9
- package/dist/array/partition.js.map +1 -1
- package/dist/array/replace.cjs +1 -1
- package/dist/array/replace.cjs.map +1 -1
- package/dist/array/replace.d.ts +2 -15
- package/dist/array/replace.d.ts.map +1 -1
- package/dist/array/replace.js +1 -12
- package/dist/array/replace.js.map +1 -1
- package/dist/array/rotate.cjs +1 -1
- package/dist/array/rotate.cjs.map +1 -1
- package/dist/array/rotate.d.ts +5 -17
- package/dist/array/rotate.d.ts.map +1 -1
- package/dist/array/rotate.js +1 -9
- package/dist/array/rotate.js.map +1 -1
- package/dist/array/search.cjs +1 -1
- package/dist/array/search.cjs.map +1 -1
- package/dist/array/search.js +1 -29
- package/dist/array/search.js.map +1 -1
- package/dist/array/sort.cjs +1 -1
- package/dist/array/sort.cjs.map +1 -1
- package/dist/array/sort.d.ts +2 -2
- package/dist/array/sort.d.ts.map +1 -1
- package/dist/array/sort.js +1 -14
- package/dist/array/sort.js.map +1 -1
- package/dist/array/take.cjs +1 -1
- package/dist/array/take.cjs.map +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.d.ts.map +1 -1
- package/dist/array/take.js +1 -8
- package/dist/array/take.js.map +1 -1
- package/dist/array/takeLast.cjs +1 -1
- package/dist/array/takeLast.cjs.map +1 -1
- package/dist/array/takeLast.d.ts +1 -1
- package/dist/array/takeLast.d.ts.map +1 -1
- package/dist/array/takeLast.js +1 -8
- package/dist/array/takeLast.js.map +1 -1
- package/dist/array/toggle.cjs +1 -1
- package/dist/array/toggle.cjs.map +1 -1
- package/dist/array/toggle.d.ts +1 -1
- package/dist/array/toggle.d.ts.map +1 -1
- package/dist/array/toggle.js +1 -8
- package/dist/array/toggle.js.map +1 -1
- package/dist/array/union.cjs +1 -1
- package/dist/array/union.cjs.map +1 -1
- package/dist/array/union.d.ts +4 -2
- package/dist/array/union.d.ts.map +1 -1
- package/dist/array/union.js +1 -8
- package/dist/array/union.js.map +1 -1
- package/dist/array/uniq.cjs +1 -1
- package/dist/array/uniq.cjs.map +1 -1
- package/dist/array/uniq.d.ts +1 -1
- package/dist/array/uniq.d.ts.map +1 -1
- package/dist/array/uniq.js +1 -8
- package/dist/array/uniq.js.map +1 -1
- package/dist/array/unzip.cjs +1 -1
- package/dist/array/unzip.cjs.map +1 -1
- package/dist/array/unzip.js +1 -10
- package/dist/array/unzip.js.map +1 -1
- package/dist/array/zip.cjs +1 -1
- package/dist/array/zip.cjs.map +1 -1
- package/dist/array/zip.d.ts +1 -1
- package/dist/array/zip.d.ts.map +1 -1
- package/dist/array/zip.js +1 -10
- package/dist/array/zip.js.map +1 -1
- package/dist/arsenal.cjs +1 -1
- package/dist/arsenal.cjs.map +1 -1
- package/dist/arsenal.iife.js +1 -1
- package/dist/arsenal.iife.js.map +1 -1
- package/dist/arsenal.js +1 -1
- package/dist/arsenal.js.map +1 -1
- package/dist/async/abortError.cjs +1 -1
- package/dist/async/abortError.cjs.map +1 -1
- package/dist/async/abortError.d.ts +3 -2
- package/dist/async/abortError.d.ts.map +1 -1
- package/dist/async/abortError.js +1 -7
- package/dist/async/abortError.js.map +1 -1
- package/dist/async/abortable.cjs +1 -1
- package/dist/async/abortable.cjs.map +1 -1
- package/dist/async/abortable.js +1 -11
- package/dist/async/abortable.js.map +1 -1
- package/dist/async/attempt.cjs +1 -1
- package/dist/async/attempt.cjs.map +1 -1
- package/dist/async/attempt.js +1 -23
- package/dist/async/attempt.js.map +1 -1
- package/dist/async/backoff.cjs +1 -1
- package/dist/async/backoff.cjs.map +1 -1
- package/dist/async/backoff.js +1 -7
- package/dist/async/backoff.js.map +1 -1
- package/dist/async/index.js +1 -10
- package/dist/async/parallel.cjs +1 -1
- package/dist/async/parallel.cjs.map +1 -1
- package/dist/async/parallel.js +1 -24
- package/dist/async/parallel.js.map +1 -1
- package/dist/async/retry.cjs +1 -1
- package/dist/async/retry.cjs.map +1 -1
- package/dist/async/retry.d.ts +4 -6
- package/dist/async/retry.d.ts.map +1 -1
- package/dist/async/retry.js +1 -24
- package/dist/async/retry.js.map +1 -1
- package/dist/async/sleep.cjs +1 -1
- package/dist/async/sleep.cjs.map +1 -1
- package/dist/async/sleep.js +1 -15
- package/dist/async/sleep.js.map +1 -1
- package/dist/async/taskPool.cjs +1 -1
- package/dist/async/taskPool.cjs.map +1 -1
- package/dist/async/taskPool.js +1 -50
- package/dist/async/taskPool.js.map +1 -1
- package/dist/async/waitFor.cjs +1 -1
- package/dist/async/waitFor.cjs.map +1 -1
- package/dist/async/waitFor.js +1 -12
- package/dist/async/waitFor.js.map +1 -1
- package/dist/cache/cache.cjs +1 -1
- package/dist/cache/cache.cjs.map +1 -1
- package/dist/cache/cache.d.ts +1 -0
- package/dist/cache/cache.d.ts.map +1 -1
- package/dist/cache/cache.js +1 -58
- package/dist/cache/cache.js.map +1 -1
- package/dist/cache/index.js +1 -3
- package/dist/cache/memo.cjs +1 -1
- package/dist/cache/memo.cjs.map +1 -1
- package/dist/cache/memo.js +1 -37
- package/dist/cache/memo.js.map +1 -1
- package/dist/encoding/base64url.cjs +2 -0
- package/dist/encoding/base64url.cjs.map +1 -0
- package/dist/encoding/base64url.d.ts +9 -0
- package/dist/encoding/base64url.d.ts.map +1 -0
- package/dist/encoding/base64url.js +2 -0
- package/dist/encoding/base64url.js.map +1 -0
- package/dist/encoding/index.cjs +1 -0
- package/dist/encoding/index.d.ts +2 -0
- package/dist/encoding/index.d.ts.map +1 -0
- package/dist/encoding/index.js +1 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +1 -9
- package/dist/errors.js.map +1 -1
- package/dist/function/assert.cjs +1 -1
- package/dist/function/assert.cjs.map +1 -1
- package/dist/function/assert.d.ts +1 -1
- package/dist/function/assert.js +1 -7
- package/dist/function/assert.js.map +1 -1
- package/dist/function/debounce.cjs +1 -1
- package/dist/function/debounce.cjs.map +1 -1
- package/dist/function/debounce.js +1 -26
- package/dist/function/debounce.js.map +1 -1
- package/dist/function/index.cjs +1 -1
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.d.ts.map +1 -1
- package/dist/function/index.js +1 -8
- package/dist/function/once.cjs +1 -1
- package/dist/function/once.cjs.map +1 -1
- package/dist/function/once.js +1 -10
- package/dist/function/once.js.map +1 -1
- package/dist/function/pipe.cjs +1 -1
- package/dist/function/pipe.cjs.map +1 -1
- package/dist/function/pipe.js +1 -9
- package/dist/function/pipe.js.map +1 -1
- package/dist/function/runAll.cjs +1 -1
- package/dist/function/runAll.cjs.map +1 -1
- package/dist/function/runAll.js +1 -18
- package/dist/function/runAll.js.map +1 -1
- package/dist/function/tap.cjs +1 -1
- package/dist/function/tap.cjs.map +1 -1
- package/dist/function/tap.js +1 -7
- package/dist/function/tap.js.map +1 -1
- package/dist/function/tapper.cjs +2 -0
- package/dist/function/tapper.cjs.map +1 -0
- package/dist/function/tapper.d.ts +27 -0
- package/dist/function/tapper.d.ts.map +1 -0
- package/dist/function/tapper.js +2 -0
- package/dist/function/tapper.js.map +1 -0
- package/dist/function/throttle.cjs +1 -1
- package/dist/function/throttle.cjs.map +1 -1
- package/dist/function/throttle.js +1 -35
- package/dist/function/throttle.js.map +1 -1
- package/dist/guards/combinators.cjs +1 -1
- package/dist/guards/combinators.cjs.map +1 -1
- package/dist/guards/combinators.js +1 -16
- package/dist/guards/combinators.js.map +1 -1
- package/dist/guards/index.cjs +1 -1
- package/dist/guards/index.js +1 -17
- package/dist/guards/isAbortError.cjs +1 -1
- package/dist/guards/isAbortError.cjs.map +1 -1
- package/dist/guards/isAbortError.js +1 -7
- package/dist/guards/isAbortError.js.map +1 -1
- package/dist/guards/isDate.cjs +1 -1
- package/dist/guards/isDate.cjs.map +1 -1
- package/dist/guards/isDate.js +1 -7
- package/dist/guards/isDate.js.map +1 -1
- package/dist/guards/isDefined.cjs +1 -1
- package/dist/guards/isDefined.cjs.map +1 -1
- package/dist/guards/isDefined.js +1 -7
- package/dist/guards/isDefined.js.map +1 -1
- package/dist/guards/isEmpty.cjs +1 -1
- package/dist/guards/isEmpty.cjs.map +1 -1
- package/dist/guards/isEmpty.d.ts.map +1 -1
- package/dist/guards/isEmpty.js +1 -9
- package/dist/guards/isEmpty.js.map +1 -1
- package/dist/guards/isEqual.cjs +1 -1
- package/dist/guards/isEqual.cjs.map +1 -1
- package/dist/guards/isEqual.js +1 -33
- package/dist/guards/isEqual.js.map +1 -1
- package/dist/guards/isError.cjs +1 -1
- package/dist/guards/isError.cjs.map +1 -1
- package/dist/guards/isError.js +1 -7
- package/dist/guards/isError.js.map +1 -1
- package/dist/guards/isFunction.cjs +1 -1
- package/dist/guards/isFunction.cjs.map +1 -1
- package/dist/guards/isFunction.d.ts +1 -1
- package/dist/guards/isFunction.d.ts.map +1 -1
- package/dist/guards/isFunction.js +1 -7
- package/dist/guards/isFunction.js.map +1 -1
- package/dist/guards/isMatch.cjs +1 -1
- package/dist/guards/isMatch.cjs.map +1 -1
- package/dist/guards/isMatch.js +1 -22
- package/dist/guards/isMatch.js.map +1 -1
- package/dist/guards/isNil.cjs +1 -1
- package/dist/guards/isNil.cjs.map +1 -1
- package/dist/guards/isNil.js +1 -7
- package/dist/guards/isNil.js.map +1 -1
- package/dist/guards/isNumber.cjs +1 -1
- package/dist/guards/isNumber.cjs.map +1 -1
- package/dist/guards/isNumber.js +1 -7
- package/dist/guards/isNumber.js.map +1 -1
- package/dist/guards/isPlainObject.cjs +1 -1
- package/dist/guards/isPlainObject.cjs.map +1 -1
- package/dist/guards/isPlainObject.js +1 -9
- package/dist/guards/isPlainObject.js.map +1 -1
- package/dist/guards/isPrimitive.cjs +1 -1
- package/dist/guards/isPrimitive.cjs.map +1 -1
- package/dist/guards/isPrimitive.d.ts +4 -17
- package/dist/guards/isPrimitive.d.ts.map +1 -1
- package/dist/guards/isPrimitive.js +1 -8
- package/dist/guards/isPrimitive.js.map +1 -1
- package/dist/guards/isPromise.cjs +1 -1
- package/dist/guards/isPromise.cjs.map +1 -1
- package/dist/guards/isPromise.js +1 -7
- package/dist/guards/isPromise.js.map +1 -1
- package/dist/guards/isRegex.cjs +1 -1
- package/dist/guards/isRegex.cjs.map +1 -1
- package/dist/guards/isRegex.js +1 -7
- package/dist/guards/isRegex.js.map +1 -1
- package/dist/guards/shallowEqual.cjs +1 -1
- package/dist/guards/shallowEqual.cjs.map +1 -1
- package/dist/guards/shallowEqual.js +1 -19
- package/dist/guards/shallowEqual.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -30
- package/dist/math/allocate.cjs +1 -1
- package/dist/math/allocate.cjs.map +1 -1
- package/dist/math/allocate.js +1 -18
- package/dist/math/allocate.js.map +1 -1
- package/dist/math/average.cjs +1 -1
- package/dist/math/average.cjs.map +1 -1
- package/dist/math/average.d.ts +3 -2
- package/dist/math/average.d.ts.map +1 -1
- package/dist/math/average.js +1 -13
- package/dist/math/average.js.map +1 -1
- package/dist/math/clamp.cjs +1 -1
- package/dist/math/clamp.cjs.map +1 -1
- package/dist/math/clamp.js +1 -7
- package/dist/math/clamp.js.map +1 -1
- package/dist/math/gcd.cjs +1 -1
- package/dist/math/gcd.cjs.map +1 -1
- package/dist/math/gcd.d.ts.map +1 -1
- package/dist/math/gcd.js +1 -12
- package/dist/math/gcd.js.map +1 -1
- package/dist/math/index.cjs +1 -1
- package/dist/math/index.d.ts +0 -1
- package/dist/math/index.d.ts.map +1 -1
- package/dist/math/index.js +1 -17
- package/dist/math/lcm.cjs +1 -1
- package/dist/math/lcm.cjs.map +1 -1
- package/dist/math/lcm.d.ts.map +1 -1
- package/dist/math/lcm.js +1 -8
- package/dist/math/lcm.js.map +1 -1
- package/dist/math/lerp.cjs +1 -1
- package/dist/math/lerp.cjs.map +1 -1
- package/dist/math/lerp.js +1 -7
- package/dist/math/lerp.js.map +1 -1
- package/dist/math/linspace.cjs +1 -1
- package/dist/math/linspace.cjs.map +1 -1
- package/dist/math/linspace.d.ts.map +1 -1
- package/dist/math/linspace.js +1 -10
- package/dist/math/linspace.js.map +1 -1
- package/dist/math/median.cjs +1 -1
- package/dist/math/median.cjs.map +1 -1
- package/dist/math/median.d.ts +1 -1
- package/dist/math/median.d.ts.map +1 -1
- package/dist/math/median.js +1 -11
- package/dist/math/median.js.map +1 -1
- package/dist/math/mod.cjs +1 -1
- package/dist/math/mod.cjs.map +1 -1
- package/dist/math/mod.js +1 -8
- package/dist/math/mod.js.map +1 -1
- package/dist/math/normalize.cjs +1 -1
- package/dist/math/normalize.cjs.map +1 -1
- package/dist/math/normalize.js +1 -8
- package/dist/math/normalize.js.map +1 -1
- package/dist/math/range.cjs +1 -1
- package/dist/math/range.cjs.map +1 -1
- package/dist/math/range.js +1 -25
- package/dist/math/range.js.map +1 -1
- package/dist/math/round.cjs +1 -1
- package/dist/math/round.cjs.map +1 -1
- package/dist/math/round.js +1 -9
- package/dist/math/round.js.map +1 -1
- package/dist/math/standardDeviation.cjs +1 -1
- package/dist/math/standardDeviation.cjs.map +1 -1
- package/dist/math/standardDeviation.d.ts +1 -1
- package/dist/math/standardDeviation.d.ts.map +1 -1
- package/dist/math/standardDeviation.js +1 -8
- package/dist/math/standardDeviation.js.map +1 -1
- package/dist/math/sum.cjs +1 -1
- package/dist/math/sum.cjs.map +1 -1
- package/dist/math/sum.d.ts +1 -1
- package/dist/math/sum.d.ts.map +1 -1
- package/dist/math/sum.js +1 -11
- package/dist/math/sum.js.map +1 -1
- package/dist/math/variance.cjs +1 -1
- package/dist/math/variance.cjs.map +1 -1
- package/dist/math/variance.d.ts +1 -1
- package/dist/math/variance.d.ts.map +1 -1
- package/dist/math/variance.js +1 -10
- package/dist/math/variance.js.map +1 -1
- package/dist/object/defaults.cjs +1 -1
- package/dist/object/defaults.cjs.map +1 -1
- package/dist/object/defaults.js +1 -11
- package/dist/object/defaults.js.map +1 -1
- package/dist/object/diff.cjs +1 -1
- package/dist/object/diff.cjs.map +1 -1
- package/dist/object/diff.d.ts +1 -1
- package/dist/object/diff.d.ts.map +1 -1
- package/dist/object/diff.js +1 -26
- package/dist/object/diff.js.map +1 -1
- package/dist/object/filterValues.cjs +1 -1
- package/dist/object/filterValues.cjs.map +1 -1
- package/dist/object/filterValues.js +1 -10
- package/dist/object/filterValues.js.map +1 -1
- package/dist/object/flattenPaths.cjs +1 -1
- package/dist/object/flattenPaths.cjs.map +1 -1
- package/dist/object/flattenPaths.js +1 -30
- package/dist/object/flattenPaths.js.map +1 -1
- package/dist/object/getPath.cjs +1 -1
- package/dist/object/getPath.cjs.map +1 -1
- package/dist/object/getPath.js +1 -25
- package/dist/object/getPath.js.map +1 -1
- package/dist/object/hash.cjs +1 -1
- package/dist/object/hash.cjs.map +1 -1
- package/dist/object/hash.js +1 -27
- package/dist/object/hash.js.map +1 -1
- package/dist/object/index.js +1 -15
- package/dist/object/invert.cjs +1 -1
- package/dist/object/invert.cjs.map +1 -1
- package/dist/object/invert.js +1 -10
- package/dist/object/invert.js.map +1 -1
- package/dist/object/mapKeys.cjs +1 -1
- package/dist/object/mapKeys.cjs.map +1 -1
- package/dist/object/mapKeys.js +1 -14
- package/dist/object/mapKeys.js.map +1 -1
- package/dist/object/mapValues.cjs +1 -1
- package/dist/object/mapValues.cjs.map +1 -1
- package/dist/object/mapValues.js +1 -10
- package/dist/object/mapValues.js.map +1 -1
- package/dist/object/merge.cjs +1 -1
- package/dist/object/merge.cjs.map +1 -1
- package/dist/object/merge.js +1 -25
- package/dist/object/merge.js.map +1 -1
- package/dist/object/omit.cjs +1 -1
- package/dist/object/omit.cjs.map +1 -1
- package/dist/object/omit.js +1 -10
- package/dist/object/omit.js.map +1 -1
- package/dist/object/pick.cjs +1 -1
- package/dist/object/pick.cjs.map +1 -1
- package/dist/object/pick.js +1 -10
- package/dist/object/pick.js.map +1 -1
- package/dist/object/prune.cjs +1 -1
- package/dist/object/prune.cjs.map +1 -1
- package/dist/object/prune.d.ts.map +1 -1
- package/dist/object/prune.js +1 -34
- package/dist/object/prune.js.map +1 -1
- package/dist/object/tryParseJson.cjs +1 -1
- package/dist/object/tryParseJson.cjs.map +1 -1
- package/dist/object/tryParseJson.js +1 -17
- package/dist/object/tryParseJson.js.map +1 -1
- package/dist/random/_index.cjs +1 -1
- package/dist/random/_index.cjs.map +1 -1
- package/dist/random/_index.d.ts +1 -1
- package/dist/random/_index.d.ts.map +1 -1
- package/dist/random/_index.js +1 -9
- package/dist/random/_index.js.map +1 -1
- package/dist/random/draw.cjs +1 -1
- package/dist/random/draw.cjs.map +1 -1
- package/dist/random/draw.js +1 -20
- package/dist/random/draw.js.map +1 -1
- package/dist/random/index.cjs +1 -1
- package/dist/random/index.d.ts +0 -1
- package/dist/random/index.d.ts.map +1 -1
- package/dist/random/index.js +1 -5
- package/dist/random/random.cjs +1 -1
- package/dist/random/random.cjs.map +1 -1
- package/dist/random/random.js +1 -9
- package/dist/random/random.js.map +1 -1
- package/dist/random/shuffle.cjs +1 -1
- package/dist/random/shuffle.cjs.map +1 -1
- package/dist/random/shuffle.js +1 -13
- package/dist/random/shuffle.js.map +1 -1
- package/dist/random/source.cjs +2 -0
- package/dist/random/source.cjs.map +1 -0
- package/dist/random/source.d.ts +2 -0
- package/dist/random/source.d.ts.map +1 -1
- package/dist/random/source.js +2 -0
- package/dist/random/source.js.map +1 -0
- package/dist/string/_caseUtils.cjs +1 -1
- package/dist/string/_caseUtils.cjs.map +1 -1
- package/dist/string/_caseUtils.js +1 -12
- package/dist/string/_caseUtils.js.map +1 -1
- package/dist/string/camelCase.cjs +1 -1
- package/dist/string/camelCase.cjs.map +1 -1
- package/dist/string/camelCase.js +1 -8
- package/dist/string/camelCase.js.map +1 -1
- package/dist/string/escape.cjs +1 -1
- package/dist/string/escape.cjs.map +1 -1
- package/dist/string/escape.js +1 -14
- package/dist/string/escape.js.map +1 -1
- package/dist/string/index.cjs +1 -1
- package/dist/string/index.d.ts +1 -1
- package/dist/string/index.d.ts.map +1 -1
- package/dist/string/index.js +1 -12
- package/dist/string/kebabCase.cjs +1 -1
- package/dist/string/kebabCase.cjs.map +1 -1
- package/dist/string/kebabCase.js +1 -8
- package/dist/string/kebabCase.js.map +1 -1
- package/dist/string/padCenter.cjs +2 -0
- package/dist/string/padCenter.cjs.map +1 -0
- package/dist/string/padCenter.d.ts +3 -0
- package/dist/string/padCenter.d.ts.map +1 -0
- package/dist/string/padCenter.js +2 -0
- package/dist/string/padCenter.js.map +1 -0
- package/dist/string/pascalCase.cjs +1 -1
- package/dist/string/pascalCase.cjs.map +1 -1
- package/dist/string/pascalCase.js +1 -8
- package/dist/string/pascalCase.js.map +1 -1
- package/dist/string/similarity.cjs +1 -1
- package/dist/string/similarity.cjs.map +1 -1
- package/dist/string/similarity.js +1 -22
- package/dist/string/similarity.js.map +1 -1
- package/dist/string/snakeCase.cjs +1 -1
- package/dist/string/snakeCase.cjs.map +1 -1
- package/dist/string/snakeCase.js +1 -8
- package/dist/string/snakeCase.js.map +1 -1
- package/dist/string/titleCase.cjs +1 -1
- package/dist/string/titleCase.cjs.map +1 -1
- package/dist/string/titleCase.js +1 -8
- package/dist/string/titleCase.js.map +1 -1
- package/dist/string/truncate.cjs +1 -1
- package/dist/string/truncate.cjs.map +1 -1
- package/dist/string/truncate.js +1 -15
- package/dist/string/truncate.js.map +1 -1
- package/dist/string/unescape.cjs +1 -1
- package/dist/string/unescape.cjs.map +1 -1
- package/dist/string/unescape.js +1 -14
- package/dist/string/unescape.js.map +1 -1
- package/dist/string/words.cjs +1 -1
- package/dist/string/words.cjs.map +1 -1
- package/dist/string/words.js +1 -9
- package/dist/string/words.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -8
- package/dist/array/flatten.cjs +0 -2
- package/dist/array/flatten.cjs.map +0 -1
- package/dist/array/flatten.d.ts +0 -5
- package/dist/array/flatten.d.ts.map +0 -1
- package/dist/array/flatten.js +0 -11
- package/dist/array/flatten.js.map +0 -1
- package/dist/math/percent.cjs +0 -2
- package/dist/math/percent.cjs.map +0 -1
- package/dist/math/percent.d.ts +0 -19
- package/dist/math/percent.d.ts.map +0 -1
- package/dist/math/percent.js +0 -8
- package/dist/math/percent.js.map +0 -1
- package/dist/random/uuid.cjs +0 -2
- package/dist/random/uuid.cjs.map +0 -1
- package/dist/random/uuid.d.ts +0 -12
- package/dist/random/uuid.d.ts.map +0 -1
- package/dist/random/uuid.js +0 -8
- package/dist/random/uuid.js.map +0 -1
- package/dist/string/pad.cjs +0 -2
- package/dist/string/pad.cjs.map +0 -1
- package/dist/string/pad.d.ts +0 -5
- package/dist/string/pad.d.ts.map +0 -1
- package/dist/string/pad.js +0 -10
- package/dist/string/pad.js.map +0 -1
package/dist/array/replace.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t, n) {
|
|
3
|
-
let r = e.findIndex(t);
|
|
4
|
-
return r === -1 ? e : [
|
|
5
|
-
...e.slice(0, r),
|
|
6
|
-
n,
|
|
7
|
-
...e.slice(r + 1)
|
|
8
|
-
];
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { e as replace };
|
|
12
|
-
|
|
1
|
+
function replace(e,t,n){let r=e.findIndex(t);return r===-1?e:[...e.slice(0,r),n,...e.slice(r+1)]}export{replace};
|
|
13
2
|
//# sourceMappingURL=replace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.js","names":[],"sources":["../../src/array/replace.ts"],"sourcesContent":["import type { Predicate } from '../types';\n\n
|
|
1
|
+
{"version":3,"file":"replace.js","names":[],"sources":["../../src/array/replace.ts"],"sourcesContent":["import type { Predicate } from '../types';\n\n/** Replaces the first matching item without mutating the input. */\nexport function replace<T>(array: T[], predicate: Predicate<T>, value: T): T[];\nexport function replace<T>(array: readonly T[], predicate: Predicate<T>, value: T): readonly T[];\nexport function replace<T>(array: readonly T[], predicate: Predicate<T>, value: T): readonly T[] {\n const index = array.findIndex(predicate);\n\n if (index === -1) return array;\n\n return [...array.slice(0, index), value, ...array.slice(index + 1)];\n}\n"],"mappings":"AAKA,SAAgB,QAAW,EAAqB,EAAyB,EAAwB,CAC/F,IAAM,EAAQ,EAAM,UAAU,CAAS,EAIvC,OAFI,IAAU,GAAW,EAElB,CAAC,GAAG,EAAM,MAAM,EAAG,CAAK,EAAG,EAAO,GAAG,EAAM,MAAM,EAAQ,CAAC,CAAC,CACpE"}
|
package/dist/array/rotate.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function rotate(e,t,{wrap:n=!1}={}){if(e.length===0)return e;let r=(t%e.length+e.length)%e.length,i=e.slice(r);return n?[...i,...e.slice(0,r)]:i}exports.rotate=rotate;
|
|
2
2
|
//# sourceMappingURL=rotate.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotate.cjs","names":[],"sources":["../../src/array/rotate.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"rotate.cjs","names":[],"sources":["../../src/array/rotate.ts"],"sourcesContent":["/** Rotates or drops leading items without mutating the input. */\nexport function rotate<T>(array: T[], positions: number, options?: { wrap?: boolean }): T[];\nexport function rotate<T>(array: readonly T[], positions: number, options?: { wrap?: boolean }): readonly T[];\nexport function rotate<T>(\n array: readonly T[],\n positions: number,\n { wrap = false }: { wrap?: boolean } = {},\n): readonly T[] {\n if (array.length === 0) return array;\n\n const normalizedPosition = ((positions % array.length) + array.length) % array.length;\n const rotated = array.slice(normalizedPosition);\n\n return wrap ? [...rotated, ...array.slice(0, normalizedPosition)] : rotated;\n}\n"],"mappings":"AAGA,SAAgB,OACd,EACA,EACA,CAAE,OAAO,IAA8B,CAAC,EAC1B,CACd,GAAI,EAAM,SAAW,EAAG,OAAO,EAE/B,IAAM,GAAuB,EAAY,EAAM,OAAU,EAAM,QAAU,EAAM,OACzE,EAAU,EAAM,MAAM,CAAkB,EAE9C,OAAO,EAAO,CAAC,GAAG,EAAS,GAAG,EAAM,MAAM,EAAG,CAAkB,CAAC,EAAI,CACtE"}
|
package/dist/array/rotate.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* const arr = [1, 2, 3, 4, 5];
|
|
7
|
-
* rotate(arr, 2); // [3, 4, 5]
|
|
8
|
-
* rotate(arr, 2, { wrap: true }); // [3, 4, 5, 1, 2]
|
|
9
|
-
* ```
|
|
10
|
-
* @param array - The array to rotate.
|
|
11
|
-
* @param positions - The number of positions to rotate the array.
|
|
12
|
-
* @param [options] - Options for the rotate operation.
|
|
13
|
-
* @param [options.wrap] - If `true`, the rotated-out elements are appended to the end.
|
|
14
|
-
*
|
|
15
|
-
* @returns A new array with the elements rotated.
|
|
16
|
-
*/
|
|
17
|
-
export declare function rotate<T>(array: T[], positions: number, { wrap }?: {
|
|
1
|
+
/** Rotates or drops leading items without mutating the input. */
|
|
2
|
+
export declare function rotate<T>(array: T[], positions: number, options?: {
|
|
18
3
|
wrap?: boolean;
|
|
19
4
|
}): T[];
|
|
5
|
+
export declare function rotate<T>(array: readonly T[], positions: number, options?: {
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
}): readonly T[];
|
|
20
8
|
//# sourceMappingURL=rotate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../../src/array/rotate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../../src/array/rotate.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,CAAC,EAAE,CAAC;AAC5F,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC,EAAE,CAAC"}
|
package/dist/array/rotate.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t, { wrap: n = !1 } = {}) {
|
|
3
|
-
if (e.length === 0) return e;
|
|
4
|
-
let r = (t % e.length + e.length) % e.length, i = e.slice(r);
|
|
5
|
-
return n ? [...i, ...e.slice(0, r)] : i;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { e as rotate };
|
|
9
|
-
|
|
1
|
+
function rotate(e,t,{wrap:n=!1}={}){if(e.length===0)return e;let r=(t%e.length+e.length)%e.length,i=e.slice(r);return n?[...i,...e.slice(0,r)]:i}export{rotate};
|
|
10
2
|
//# sourceMappingURL=rotate.js.map
|
package/dist/array/rotate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotate.js","names":[],"sources":["../../src/array/rotate.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"rotate.js","names":[],"sources":["../../src/array/rotate.ts"],"sourcesContent":["/** Rotates or drops leading items without mutating the input. */\nexport function rotate<T>(array: T[], positions: number, options?: { wrap?: boolean }): T[];\nexport function rotate<T>(array: readonly T[], positions: number, options?: { wrap?: boolean }): readonly T[];\nexport function rotate<T>(\n array: readonly T[],\n positions: number,\n { wrap = false }: { wrap?: boolean } = {},\n): readonly T[] {\n if (array.length === 0) return array;\n\n const normalizedPosition = ((positions % array.length) + array.length) % array.length;\n const rotated = array.slice(normalizedPosition);\n\n return wrap ? [...rotated, ...array.slice(0, normalizedPosition)] : rotated;\n}\n"],"mappings":"AAGA,SAAgB,OACd,EACA,EACA,CAAE,OAAO,IAA8B,CAAC,EAC1B,CACd,GAAI,EAAM,SAAW,EAAG,OAAO,EAE/B,IAAM,GAAuB,EAAY,EAAM,OAAU,EAAM,QAAU,EAAM,OACzE,EAAU,EAAM,MAAM,CAAkB,EAE9C,OAAO,EAAO,CAAC,GAAG,EAAS,GAAG,EAAM,MAAM,EAAG,CAAkB,CAAC,EAAI,CACtE"}
|
package/dist/array/search.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../string/similarity.cjs");var
|
|
1
|
+
const e=require("../string/similarity.cjs");var normalizeText=e=>e.normalize(`NFKD`).replace(/\p{M}/gu,``),termsFor=(e,t)=>{let n=t(e);return typeof n==`string`?[n]:n},prepareQuery=(e,t)=>{let n=e.trim().toLowerCase();return t?normalizeText(n):n},score=(t,n,r,i)=>termsFor(t,i).reduce((t,i)=>{let a=r?normalizeText(i.toLowerCase()):i.toLowerCase();return Math.max(t,e.similarity(a,n))},0),stringSelection=e=>e;function fuzzyFilter(e,t,n={}){let{normalize:r=!1,threshold:i=.25}=n,a=`select`in n?n.select:stringSelection,o=prepareQuery(t,r);return o?e.filter(e=>score(e,o,r,a)>=i):[...e]}function fuzzyScore(e,t,n={}){let{normalize:r=!1,threshold:i=.25}=n,a=`select`in n?n.select:stringSelection,o=prepareQuery(t,r);return o?e.map(e=>({item:e,score:score(e,o,r,a)})).filter(e=>e.score>=i).sort((e,t)=>t.score-e.score):e.map(e=>({item:e,score:1}))}exports.fuzzyFilter=fuzzyFilter,exports.fuzzyScore=fuzzyScore;
|
|
2
2
|
//# sourceMappingURL=search.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.cjs","names":[],"sources":["../../src/array/search.ts"],"sourcesContent":["import { similarity } from '../string/similarity';\n\nexport type ScoredResult<T> = { item: T; score: number };\n\nexport type FuzzyOptions = {\n normalize?: boolean;\n threshold?: number;\n};\n\nexport type FuzzySelection<T> = FuzzyOptions & {\n select: (item: T) => string | readonly string[];\n};\n\nconst normalizeText = (value: string): string => value.normalize('NFKD').replace(/\\p{M}/gu, '');\n\nconst termsFor = <T>(item: T, select: (item: T) => string | readonly string[]): readonly string[] => {\n const selected = select(item);\n\n return typeof selected === 'string' ? [selected] : selected;\n};\n\nconst prepareQuery = (query: string, normalize: boolean): string => {\n const trimmed = query.trim().toLowerCase();\n\n return normalize ? normalizeText(trimmed) : trimmed;\n};\n\nconst score = <T>(\n item: T,\n query: string,\n normalize: boolean,\n select: (item: T) => string | readonly string[],\n): number => {\n return termsFor(item, select).reduce((best, term) => {\n const value = normalize ? normalizeText(term.toLowerCase()) : term.toLowerCase();\n\n return Math.max(best, similarity(value, query));\n }, 0);\n};\n\nconst stringSelection = (value: string): string => value;\n\nexport function fuzzyFilter(array: readonly string[], query: string, options?: FuzzyOptions): string[];\nexport function fuzzyFilter<T>(array: readonly T[], query: string, options: FuzzySelection<T>): T[];\nexport function fuzzyFilter<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): T[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return [...array];\n\n return array.filter((item) => score(item, searchTerm, normalize, select) >= threshold);\n}\n\nexport function fuzzyScore(array: readonly string[], query: string, options?: FuzzyOptions): ScoredResult<string>[];\nexport function fuzzyScore<T>(array: readonly T[], query: string, options: FuzzySelection<T>): ScoredResult<T>[];\nexport function fuzzyScore<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): ScoredResult<T>[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return array.map((item) => ({ item, score: 1 }));\n\n return array\n .map((item) => ({ item, score: score(item, searchTerm, normalize, select) }))\n .filter((result) => result.score >= threshold)\n .sort((a, b) => b.score - a.score);\n}\n"],"mappings":"4CAaA,IAAM,
|
|
1
|
+
{"version":3,"file":"search.cjs","names":[],"sources":["../../src/array/search.ts"],"sourcesContent":["import { similarity } from '../string/similarity';\n\nexport type ScoredResult<T> = { item: T; score: number };\n\nexport type FuzzyOptions = {\n normalize?: boolean;\n threshold?: number;\n};\n\nexport type FuzzySelection<T> = FuzzyOptions & {\n select: (item: T) => string | readonly string[];\n};\n\nconst normalizeText = (value: string): string => value.normalize('NFKD').replace(/\\p{M}/gu, '');\n\nconst termsFor = <T>(item: T, select: (item: T) => string | readonly string[]): readonly string[] => {\n const selected = select(item);\n\n return typeof selected === 'string' ? [selected] : selected;\n};\n\nconst prepareQuery = (query: string, normalize: boolean): string => {\n const trimmed = query.trim().toLowerCase();\n\n return normalize ? normalizeText(trimmed) : trimmed;\n};\n\nconst score = <T>(\n item: T,\n query: string,\n normalize: boolean,\n select: (item: T) => string | readonly string[],\n): number => {\n return termsFor(item, select).reduce((best, term) => {\n const value = normalize ? normalizeText(term.toLowerCase()) : term.toLowerCase();\n\n return Math.max(best, similarity(value, query));\n }, 0);\n};\n\nconst stringSelection = (value: string): string => value;\n\nexport function fuzzyFilter(array: readonly string[], query: string, options?: FuzzyOptions): string[];\nexport function fuzzyFilter<T>(array: readonly T[], query: string, options: FuzzySelection<T>): T[];\nexport function fuzzyFilter<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): T[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return [...array];\n\n return array.filter((item) => score(item, searchTerm, normalize, select) >= threshold);\n}\n\nexport function fuzzyScore(array: readonly string[], query: string, options?: FuzzyOptions): ScoredResult<string>[];\nexport function fuzzyScore<T>(array: readonly T[], query: string, options: FuzzySelection<T>): ScoredResult<T>[];\nexport function fuzzyScore<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): ScoredResult<T>[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return array.map((item) => ({ item, score: 1 }));\n\n return array\n .map((item) => ({ item, score: score(item, searchTerm, normalize, select) }))\n .filter((result) => result.score >= threshold)\n .sort((a, b) => b.score - a.score);\n}\n"],"mappings":"4CAaA,IAAM,cAAiB,GAA0B,EAAM,UAAU,MAAM,CAAC,CAAC,QAAQ,UAAW,EAAE,EAExF,UAAe,EAAS,IAAuE,CACnG,IAAM,EAAW,EAAO,CAAI,EAE5B,OAAO,OAAO,GAAa,SAAW,CAAC,CAAQ,EAAI,CACrD,EAEM,cAAgB,EAAe,IAA+B,CAClE,IAAM,EAAU,EAAM,KAAK,CAAC,CAAC,YAAY,EAEzC,OAAO,EAAY,cAAc,CAAO,EAAI,CAC9C,EAEM,OACJ,EACA,EACA,EACA,IAEO,SAAS,EAAM,CAAM,CAAC,CAAC,QAAQ,EAAM,IAAS,CACnD,IAAM,EAAQ,EAAY,cAAc,EAAK,YAAY,CAAC,EAAI,EAAK,YAAY,EAE/E,OAAO,KAAK,IAAI,EAAM,EAAA,WAAW,EAAO,CAAK,CAAC,CAChD,EAAG,CAAC,EAGA,gBAAmB,GAA0B,EAInD,SAAgB,YACd,EACA,EACA,EAA4C,CAAC,EACxC,CACL,GAAM,CAAE,YAAY,GAAO,YAAY,KAAS,EAC1C,EAAS,WAAY,EAAU,EAAQ,OAAU,gBACjD,EAAa,aAAa,EAAO,CAAS,EAIhD,OAFK,EAEE,EAAM,OAAQ,GAAS,MAAM,EAAM,EAAY,EAAW,CAAM,GAAK,CAAS,EAF7D,CAAC,GAAG,CAAK,CAGnC,CAIA,SAAgB,WACd,EACA,EACA,EAA4C,CAAC,EAC1B,CACnB,GAAM,CAAE,YAAY,GAAO,YAAY,KAAS,EAC1C,EAAS,WAAY,EAAU,EAAQ,OAAU,gBACjD,EAAa,aAAa,EAAO,CAAS,EAIhD,OAFK,EAEE,EACJ,IAAK,IAAU,CAAE,OAAM,MAAO,MAAM,EAAM,EAAY,EAAW,CAAM,CAAE,EAAE,CAAC,CAC5E,OAAQ,GAAW,EAAO,OAAS,CAAS,CAAC,CAC7C,MAAM,EAAG,IAAM,EAAE,MAAQ,EAAE,KAAK,EALX,EAAM,IAAK,IAAU,CAAE,OAAM,MAAO,CAAE,EAAE,CAMlE"}
|
package/dist/array/search.js
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/search.ts
|
|
3
|
-
var t = (e) => e.normalize("NFKD").replace(/\p{M}/gu, ""), n = (e, t) => {
|
|
4
|
-
let n = t(e);
|
|
5
|
-
return typeof n == "string" ? [n] : n;
|
|
6
|
-
}, r = (e, n) => {
|
|
7
|
-
let r = e.trim().toLowerCase();
|
|
8
|
-
return n ? t(r) : r;
|
|
9
|
-
}, i = (r, i, a, o) => n(r, o).reduce((n, r) => {
|
|
10
|
-
let o = a ? t(r.toLowerCase()) : r.toLowerCase();
|
|
11
|
-
return Math.max(n, e(o, i));
|
|
12
|
-
}, 0), a = (e) => e;
|
|
13
|
-
function o(e, t, n = {}) {
|
|
14
|
-
let { normalize: o = !1, threshold: s = .25 } = n, c = "select" in n ? n.select : a, l = r(t, o);
|
|
15
|
-
return l ? e.filter((e) => i(e, l, o, c) >= s) : [...e];
|
|
16
|
-
}
|
|
17
|
-
function s(e, t, n = {}) {
|
|
18
|
-
let { normalize: o = !1, threshold: s = .25 } = n, c = "select" in n ? n.select : a, l = r(t, o);
|
|
19
|
-
return l ? e.map((e) => ({
|
|
20
|
-
item: e,
|
|
21
|
-
score: i(e, l, o, c)
|
|
22
|
-
})).filter((e) => e.score >= s).sort((e, t) => t.score - e.score) : e.map((e) => ({
|
|
23
|
-
item: e,
|
|
24
|
-
score: 1
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { o as fuzzyFilter, s as fuzzyScore };
|
|
29
|
-
|
|
1
|
+
import{similarity as e}from"../string/similarity.js";var normalizeText=e=>e.normalize(`NFKD`).replace(/\p{M}/gu,``),termsFor=(e,t)=>{let n=t(e);return typeof n==`string`?[n]:n},prepareQuery=(e,t)=>{let n=e.trim().toLowerCase();return t?normalizeText(n):n},score=(t,n,r,i)=>termsFor(t,i).reduce((t,i)=>{let a=r?normalizeText(i.toLowerCase()):i.toLowerCase();return Math.max(t,e(a,n))},0),stringSelection=e=>e;function fuzzyFilter(e,t,n={}){let{normalize:r=!1,threshold:i=.25}=n,a=`select`in n?n.select:stringSelection,o=prepareQuery(t,r);return o?e.filter(e=>score(e,o,r,a)>=i):[...e]}function fuzzyScore(e,t,n={}){let{normalize:r=!1,threshold:i=.25}=n,a=`select`in n?n.select:stringSelection,o=prepareQuery(t,r);return o?e.map(e=>({item:e,score:score(e,o,r,a)})).filter(e=>e.score>=i).sort((e,t)=>t.score-e.score):e.map(e=>({item:e,score:1}))}export{fuzzyFilter,fuzzyScore};
|
|
30
2
|
//# sourceMappingURL=search.js.map
|
package/dist/array/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","names":[],"sources":["../../src/array/search.ts"],"sourcesContent":["import { similarity } from '../string/similarity';\n\nexport type ScoredResult<T> = { item: T; score: number };\n\nexport type FuzzyOptions = {\n normalize?: boolean;\n threshold?: number;\n};\n\nexport type FuzzySelection<T> = FuzzyOptions & {\n select: (item: T) => string | readonly string[];\n};\n\nconst normalizeText = (value: string): string => value.normalize('NFKD').replace(/\\p{M}/gu, '');\n\nconst termsFor = <T>(item: T, select: (item: T) => string | readonly string[]): readonly string[] => {\n const selected = select(item);\n\n return typeof selected === 'string' ? [selected] : selected;\n};\n\nconst prepareQuery = (query: string, normalize: boolean): string => {\n const trimmed = query.trim().toLowerCase();\n\n return normalize ? normalizeText(trimmed) : trimmed;\n};\n\nconst score = <T>(\n item: T,\n query: string,\n normalize: boolean,\n select: (item: T) => string | readonly string[],\n): number => {\n return termsFor(item, select).reduce((best, term) => {\n const value = normalize ? normalizeText(term.toLowerCase()) : term.toLowerCase();\n\n return Math.max(best, similarity(value, query));\n }, 0);\n};\n\nconst stringSelection = (value: string): string => value;\n\nexport function fuzzyFilter(array: readonly string[], query: string, options?: FuzzyOptions): string[];\nexport function fuzzyFilter<T>(array: readonly T[], query: string, options: FuzzySelection<T>): T[];\nexport function fuzzyFilter<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): T[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return [...array];\n\n return array.filter((item) => score(item, searchTerm, normalize, select) >= threshold);\n}\n\nexport function fuzzyScore(array: readonly string[], query: string, options?: FuzzyOptions): ScoredResult<string>[];\nexport function fuzzyScore<T>(array: readonly T[], query: string, options: FuzzySelection<T>): ScoredResult<T>[];\nexport function fuzzyScore<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): ScoredResult<T>[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return array.map((item) => ({ item, score: 1 }));\n\n return array\n .map((item) => ({ item, score: score(item, searchTerm, normalize, select) }))\n .filter((result) => result.score >= threshold)\n .sort((a, b) => b.score - a.score);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","names":[],"sources":["../../src/array/search.ts"],"sourcesContent":["import { similarity } from '../string/similarity';\n\nexport type ScoredResult<T> = { item: T; score: number };\n\nexport type FuzzyOptions = {\n normalize?: boolean;\n threshold?: number;\n};\n\nexport type FuzzySelection<T> = FuzzyOptions & {\n select: (item: T) => string | readonly string[];\n};\n\nconst normalizeText = (value: string): string => value.normalize('NFKD').replace(/\\p{M}/gu, '');\n\nconst termsFor = <T>(item: T, select: (item: T) => string | readonly string[]): readonly string[] => {\n const selected = select(item);\n\n return typeof selected === 'string' ? [selected] : selected;\n};\n\nconst prepareQuery = (query: string, normalize: boolean): string => {\n const trimmed = query.trim().toLowerCase();\n\n return normalize ? normalizeText(trimmed) : trimmed;\n};\n\nconst score = <T>(\n item: T,\n query: string,\n normalize: boolean,\n select: (item: T) => string | readonly string[],\n): number => {\n return termsFor(item, select).reduce((best, term) => {\n const value = normalize ? normalizeText(term.toLowerCase()) : term.toLowerCase();\n\n return Math.max(best, similarity(value, query));\n }, 0);\n};\n\nconst stringSelection = (value: string): string => value;\n\nexport function fuzzyFilter(array: readonly string[], query: string, options?: FuzzyOptions): string[];\nexport function fuzzyFilter<T>(array: readonly T[], query: string, options: FuzzySelection<T>): T[];\nexport function fuzzyFilter<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): T[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return [...array];\n\n return array.filter((item) => score(item, searchTerm, normalize, select) >= threshold);\n}\n\nexport function fuzzyScore(array: readonly string[], query: string, options?: FuzzyOptions): ScoredResult<string>[];\nexport function fuzzyScore<T>(array: readonly T[], query: string, options: FuzzySelection<T>): ScoredResult<T>[];\nexport function fuzzyScore<T>(\n array: readonly T[],\n query: string,\n options: FuzzyOptions | FuzzySelection<T> = {},\n): ScoredResult<T>[] {\n const { normalize = false, threshold = 0.25 } = options;\n const select = 'select' in options ? options.select : (stringSelection as (item: T) => string);\n const searchTerm = prepareQuery(query, normalize);\n\n if (!searchTerm) return array.map((item) => ({ item, score: 1 }));\n\n return array\n .map((item) => ({ item, score: score(item, searchTerm, normalize, select) }))\n .filter((result) => result.score >= threshold)\n .sort((a, b) => b.score - a.score);\n}\n"],"mappings":"qDAaA,IAAM,cAAiB,GAA0B,EAAM,UAAU,MAAM,CAAC,CAAC,QAAQ,UAAW,EAAE,EAExF,UAAe,EAAS,IAAuE,CACnG,IAAM,EAAW,EAAO,CAAI,EAE5B,OAAO,OAAO,GAAa,SAAW,CAAC,CAAQ,EAAI,CACrD,EAEM,cAAgB,EAAe,IAA+B,CAClE,IAAM,EAAU,EAAM,KAAK,CAAC,CAAC,YAAY,EAEzC,OAAO,EAAY,cAAc,CAAO,EAAI,CAC9C,EAEM,OACJ,EACA,EACA,EACA,IAEO,SAAS,EAAM,CAAM,CAAC,CAAC,QAAQ,EAAM,IAAS,CACnD,IAAM,EAAQ,EAAY,cAAc,EAAK,YAAY,CAAC,EAAI,EAAK,YAAY,EAE/E,OAAO,KAAK,IAAI,EAAM,EAAW,EAAO,CAAK,CAAC,CAChD,EAAG,CAAC,EAGA,gBAAmB,GAA0B,EAInD,SAAgB,YACd,EACA,EACA,EAA4C,CAAC,EACxC,CACL,GAAM,CAAE,YAAY,GAAO,YAAY,KAAS,EAC1C,EAAS,WAAY,EAAU,EAAQ,OAAU,gBACjD,EAAa,aAAa,EAAO,CAAS,EAIhD,OAFK,EAEE,EAAM,OAAQ,GAAS,MAAM,EAAM,EAAY,EAAW,CAAM,GAAK,CAAS,EAF7D,CAAC,GAAG,CAAK,CAGnC,CAIA,SAAgB,WACd,EACA,EACA,EAA4C,CAAC,EAC1B,CACnB,GAAM,CAAE,YAAY,GAAO,YAAY,KAAS,EAC1C,EAAS,WAAY,EAAU,EAAQ,OAAU,gBACjD,EAAa,aAAa,EAAO,CAAS,EAIhD,OAFK,EAEE,EACJ,IAAK,IAAU,CAAE,OAAM,MAAO,MAAM,EAAM,EAAY,EAAW,CAAM,CAAE,EAAE,CAAC,CAC5E,OAAQ,GAAW,EAAO,OAAS,CAAS,CAAC,CAC7C,MAAM,EAAG,IAAM,EAAE,MAAQ,EAAE,KAAK,EALX,EAAM,IAAK,IAAU,CAAE,OAAM,MAAO,CAAE,EAAE,CAMlE"}
|
package/dist/array/sort.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./compare.cjs"),t=require("./compareBy.cjs");function
|
|
1
|
+
const e=require("./compare.cjs"),t=require("./compareBy.cjs");function sort(n,r,i=`asc`){if(!Array.isArray(n))throw TypeError(`sort: first argument must be an array`);if(typeof r==`function`){let t=i===`desc`?-1:1;return[...n].sort((n,i)=>e.compare(r(n),r(i))*t)}return[...n].sort(t.compareBy(r))}exports.sort=sort;
|
|
2
2
|
//# sourceMappingURL=sort.cjs.map
|
package/dist/array/sort.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.cjs","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"8DA6BA,SAAgB,
|
|
1
|
+
{"version":3,"file":"sort.cjs","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"8DA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAA,QAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAA,UAAU,CAAmB,CAAC,CACvD"}
|
package/dist/array/sort.d.ts
CHANGED
|
@@ -21,6 +21,6 @@ export type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;
|
|
|
21
21
|
*
|
|
22
22
|
* @throws {TypeError} If the first argument is not an array.
|
|
23
23
|
*/
|
|
24
|
-
export declare function sort<T>(array: T[], selector: (item: T) => unknown, direction?: SortDirection): T[];
|
|
25
|
-
export declare function sort<T>(array: T[], selectors: SortSelectors<T>): T[];
|
|
24
|
+
export declare function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];
|
|
25
|
+
export declare function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];
|
|
26
26
|
//# sourceMappingURL=sort.d.ts.map
|
package/dist/array/sort.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/array/sort.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/array/sort.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,CAAC,EAAE,CAAC;AAC7G,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC"}
|
package/dist/array/sort.js
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { compareBy as t } from "./compareBy.js";
|
|
3
|
-
//#region src/array/sort.ts
|
|
4
|
-
function n(n, r, i = "asc") {
|
|
5
|
-
if (!Array.isArray(n)) throw TypeError("sort: first argument must be an array");
|
|
6
|
-
if (typeof r == "function") {
|
|
7
|
-
let t = i === "desc" ? -1 : 1;
|
|
8
|
-
return [...n].sort((n, i) => e(r(n), r(i)) * t);
|
|
9
|
-
}
|
|
10
|
-
return [...n].sort(t(r));
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { n as sort };
|
|
14
|
-
|
|
1
|
+
import{compare as e}from"./compare.js";import{compareBy as t}from"./compareBy.js";function sort(n,r,i=`asc`){if(!Array.isArray(n))throw TypeError(`sort: first argument must be an array`);if(typeof r==`function`){let t=i===`desc`?-1:1;return[...n].sort((n,i)=>e(r(n),r(i))*t)}return[...n].sort(t(r))}export{sort};
|
|
15
2
|
//# sourceMappingURL=sort.js.map
|
package/dist/array/sort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.js","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sort.js","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"kFA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAU,CAAmB,CAAC,CACvD"}
|
package/dist/array/take.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function take(e,t=1){let n=Math.max(0,Math.floor(t));return e.slice(0,n)}exports.take=take;
|
|
2
2
|
//# sourceMappingURL=take.cjs.map
|
package/dist/array/take.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"take.cjs","names":[],"sources":["../../src/array/take.ts"],"sourcesContent":["/**\n * Takes the first n elements from an array.\n */\nexport function take<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(0, count);\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"take.cjs","names":[],"sources":["../../src/array/take.ts"],"sourcesContent":["/**\n * Takes the first n elements from an array.\n */\nexport function take<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(0, count);\n}\n"],"mappings":"AAGA,SAAgB,KAAQ,EAAqB,EAAI,EAAQ,CACvD,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAEvC,OAAO,EAAM,MAAM,EAAG,CAAK,CAC7B"}
|
package/dist/array/take.d.ts
CHANGED
package/dist/array/take.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../../src/array/take.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"take.d.ts","sourceRoot":"","sources":["../../src/array/take.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAIvD"}
|
package/dist/array/take.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t = 1) {
|
|
3
|
-
let n = Math.max(0, Math.floor(t));
|
|
4
|
-
return e.slice(0, n);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { e as take };
|
|
8
|
-
|
|
1
|
+
function take(e,t=1){let n=Math.max(0,Math.floor(t));return e.slice(0,n)}export{take};
|
|
9
2
|
//# sourceMappingURL=take.js.map
|
package/dist/array/take.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"take.js","names":[],"sources":["../../src/array/take.ts"],"sourcesContent":["/**\n * Takes the first n elements from an array.\n */\nexport function take<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(0, count);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"take.js","names":[],"sources":["../../src/array/take.ts"],"sourcesContent":["/**\n * Takes the first n elements from an array.\n */\nexport function take<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(0, count);\n}\n"],"mappings":"AAGA,SAAgB,KAAQ,EAAqB,EAAI,EAAQ,CACvD,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAEvC,OAAO,EAAM,MAAM,EAAG,CAAK,CAC7B"}
|
package/dist/array/takeLast.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function takeLast(e,t=1){let n=Math.max(0,Math.floor(t));return n===0?[]:e.slice(Math.max(0,e.length-n))}exports.takeLast=takeLast;
|
|
2
2
|
//# sourceMappingURL=takeLast.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeLast.cjs","names":[],"sources":["../../src/array/takeLast.ts"],"sourcesContent":["/**\n * Takes the last n elements from an array.\n */\nexport function takeLast<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [];\n\n return array.slice(Math.max(0, array.length - count));\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"takeLast.cjs","names":[],"sources":["../../src/array/takeLast.ts"],"sourcesContent":["/**\n * Takes the last n elements from an array.\n */\nexport function takeLast<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [];\n\n return array.slice(Math.max(0, array.length - count));\n}\n"],"mappings":"AAGA,SAAgB,SAAY,EAAqB,EAAI,EAAQ,CAC3D,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAIvC,OAFI,IAAU,EAAU,CAAC,EAElB,EAAM,MAAM,KAAK,IAAI,EAAG,EAAM,OAAS,CAAK,CAAC,CACtD"}
|
package/dist/array/takeLast.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeLast.d.ts","sourceRoot":"","sources":["../../src/array/takeLast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"takeLast.d.ts","sourceRoot":"","sources":["../../src/array/takeLast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAM3D"}
|
package/dist/array/takeLast.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t = 1) {
|
|
3
|
-
let n = Math.max(0, Math.floor(t));
|
|
4
|
-
return n === 0 ? [] : e.slice(Math.max(0, e.length - n));
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { e as takeLast };
|
|
8
|
-
|
|
1
|
+
function takeLast(e,t=1){let n=Math.max(0,Math.floor(t));return n===0?[]:e.slice(Math.max(0,e.length-n))}export{takeLast};
|
|
9
2
|
//# sourceMappingURL=takeLast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeLast.js","names":[],"sources":["../../src/array/takeLast.ts"],"sourcesContent":["/**\n * Takes the last n elements from an array.\n */\nexport function takeLast<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [];\n\n return array.slice(Math.max(0, array.length - count));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"takeLast.js","names":[],"sources":["../../src/array/takeLast.ts"],"sourcesContent":["/**\n * Takes the last n elements from an array.\n */\nexport function takeLast<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [];\n\n return array.slice(Math.max(0, array.length - count));\n}\n"],"mappings":"AAGA,SAAgB,SAAY,EAAqB,EAAI,EAAQ,CAC3D,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAIvC,OAFI,IAAU,EAAU,CAAC,EAElB,EAAM,MAAM,KAAK,IAAI,EAAG,EAAM,OAAS,CAAK,CAAC,CACtD"}
|
package/dist/array/toggle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function toggle(e,t,n,r={}){let{strategy:i=`append`}=r,a=n?e=>n(e)===n(t):e=>e===t,o=e.findIndex(a);return o===-1?i===`prepend`?[t,...e]:[...e,t]:[...e.slice(0,o),...e.slice(o+1)]}exports.toggle=toggle;
|
|
2
2
|
//# sourceMappingURL=toggle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.cjs","names":[],"sources":["../../src/array/toggle.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already\n * exists in the array (toggle behaviour).\n *\n * @example\n * ```ts\n * toggle([1, 2, 3], 4) // [1, 2, 3, 4]\n * toggle([1, 2, 3], 2) // [1, 3]\n *\n * toggle(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine item identity.\n * @param [options] - Options for the toggle operation.\n * @param [options.strategy] - Where to insert when adding: 'prepend' or 'append' (default).\n * @returns A new array with the item toggled.\n */\nexport function toggle<T>(\n array: T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n"],"mappings":"AA0BA,SAAgB,
|
|
1
|
+
{"version":3,"file":"toggle.cjs","names":[],"sources":["../../src/array/toggle.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already\n * exists in the array (toggle behaviour).\n *\n * @example\n * ```ts\n * toggle([1, 2, 3], 4) // [1, 2, 3, 4]\n * toggle([1, 2, 3], 2) // [1, 3]\n *\n * toggle(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine item identity.\n * @param [options] - Options for the toggle operation.\n * @param [options.strategy] - Where to insert when adding: 'prepend' or 'append' (default).\n * @returns A new array with the item toggled.\n */\nexport function toggle<T>(\n array: readonly T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n"],"mappings":"AA0BA,SAAgB,OACd,EACA,EACA,EACA,EAA+C,CAAC,EAC3C,CACL,GAAM,CAAE,WAAW,UAAa,EAC1B,EAAY,EAAY,GAAU,EAAS,CAAE,IAAM,EAAS,CAAI,EAAK,GAAU,IAAO,EAEtF,EAAQ,EAAM,UAAU,CAAS,EAMvC,OAJI,IAAU,GAIP,IAAa,UAAY,CAAC,EAAM,GAAG,CAAK,EAAI,CAAC,GAAG,EAAO,CAAI,EAHzD,CAAC,GAAG,EAAM,MAAM,EAAG,CAAK,EAAG,GAAG,EAAM,MAAM,EAAQ,CAAC,CAAC,CAI/D"}
|
package/dist/array/toggle.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import type { Primitive } from '../types';
|
|
|
23
23
|
* @param [options.strategy] - Where to insert when adding: 'prepend' or 'append' (default).
|
|
24
24
|
* @returns A new array with the item toggled.
|
|
25
25
|
*/
|
|
26
|
-
export declare function toggle<T>(array: T[], item: T, selector?: (item: T) => Primitive, options?: {
|
|
26
|
+
export declare function toggle<T>(array: readonly T[], item: T, selector?: (item: T) => Primitive, options?: {
|
|
27
27
|
strategy?: 'prepend' | 'append';
|
|
28
28
|
}): T[];
|
|
29
29
|
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/array/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/array/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,IAAI,EAAE,CAAC,EACP,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,EACjC,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAO,GAChD,CAAC,EAAE,CAWL"}
|
package/dist/array/toggle.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t, n, r = {}) {
|
|
3
|
-
let { strategy: i = "append" } = r, a = n ? (e) => n(e) === n(t) : (e) => e === t, o = e.findIndex(a);
|
|
4
|
-
return o === -1 ? i === "prepend" ? [t, ...e] : [...e, t] : [...e.slice(0, o), ...e.slice(o + 1)];
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { e as toggle };
|
|
8
|
-
|
|
1
|
+
function toggle(e,t,n,r={}){let{strategy:i=`append`}=r,a=n?e=>n(e)===n(t):e=>e===t,o=e.findIndex(a);return o===-1?i===`prepend`?[t,...e]:[...e,t]:[...e.slice(0,o),...e.slice(o+1)]}export{toggle};
|
|
9
2
|
//# sourceMappingURL=toggle.js.map
|
package/dist/array/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","names":[],"sources":["../../src/array/toggle.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already\n * exists in the array (toggle behaviour).\n *\n * @example\n * ```ts\n * toggle([1, 2, 3], 4) // [1, 2, 3, 4]\n * toggle([1, 2, 3], 2) // [1, 3]\n *\n * toggle(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine item identity.\n * @param [options] - Options for the toggle operation.\n * @param [options.strategy] - Where to insert when adding: 'prepend' or 'append' (default).\n * @returns A new array with the item toggled.\n */\nexport function toggle<T>(\n array: T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../src/array/toggle.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Either adds or removes an item from an array, based on whether it already\n * exists in the array (toggle behaviour).\n *\n * @example\n * ```ts\n * toggle([1, 2, 3], 4) // [1, 2, 3, 4]\n * toggle([1, 2, 3], 2) // [1, 3]\n *\n * toggle(\n * [{ id: 1 }, { id: 2 }],\n * { id: 3 },\n * (obj) => obj.id,\n * { strategy: 'prepend' }\n * ) // [{ id: 3 }, { id: 1 }, { id: 2 }]\n * ```\n *\n * @param array - The array to modify.\n * @param item - The item to add or remove.\n * @param selector - A function to determine item identity.\n * @param [options] - Options for the toggle operation.\n * @param [options.strategy] - Where to insert when adding: 'prepend' or 'append' (default).\n * @returns A new array with the item toggled.\n */\nexport function toggle<T>(\n array: readonly T[],\n item: T,\n selector?: (item: T) => Primitive,\n options: { strategy?: 'prepend' | 'append' } = {},\n): T[] {\n const { strategy = 'append' } = options;\n const compareFn = selector ? (el: T) => selector(el) === selector(item) : (el: T) => el === item;\n\n const index = array.findIndex(compareFn);\n\n if (index !== -1) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n }\n\n return strategy === 'prepend' ? [item, ...array] : [...array, item];\n}\n"],"mappings":"AA0BA,SAAgB,OACd,EACA,EACA,EACA,EAA+C,CAAC,EAC3C,CACL,GAAM,CAAE,WAAW,UAAa,EAC1B,EAAY,EAAY,GAAU,EAAS,CAAE,IAAM,EAAS,CAAI,EAAK,GAAU,IAAO,EAEtF,EAAQ,EAAM,UAAU,CAAS,EAMvC,OAJI,IAAU,GAIP,IAAa,UAAY,CAAC,EAAM,GAAG,CAAK,EAAI,CAAC,GAAG,EAAO,CAAI,EAHzD,CAAC,GAAG,EAAM,MAAM,EAAG,CAAK,EAAG,GAAG,EAAM,MAAM,EAAQ,CAAC,CAAC,CAI/D"}
|
package/dist/array/union.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/_selectorSet.cjs");function
|
|
1
|
+
const e=require("../_common/_selectorSet.cjs");function union(t,n,r){return r?e.dedupeBySelector([...t,...n],r):[...new Set([...t,...n])]}exports.union=union;
|
|
2
2
|
//# sourceMappingURL=union.cjs.map
|
package/dist/array/union.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.cjs","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of
|
|
1
|
+
{"version":3,"file":"union.cjs","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of `source` and `other`.\n *\n * Allocates a new `Set` (or selector-keyed dedup structure) and a new result array.\n */\nexport function union<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":"+CAQA,SAAgB,MAAS,EAAsB,EAAqB,EAAwC,CAK1G,OAJK,EAIE,EAAA,iBAAiB,CAAC,GAAG,EAAQ,GAAG,CAAK,EAAG,CAAQ,EAH9C,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAQ,GAAG,CAAK,CAAC,CAAC,CAI7C"}
|
package/dist/array/union.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Primitive } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Returns a deduplicated union of
|
|
3
|
+
* Returns a deduplicated union of `source` and `other`.
|
|
4
|
+
*
|
|
5
|
+
* Allocates a new `Set` (or selector-keyed dedup structure) and a new result array.
|
|
4
6
|
*/
|
|
5
|
-
export declare function union<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[];
|
|
7
|
+
export declare function union<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[];
|
|
6
8
|
//# sourceMappingURL=union.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/array/union.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/array/union.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAM1G"}
|
package/dist/array/union.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/union.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return r ? e([...t, ...n], r) : [.../* @__PURE__ */ new Set([...t, ...n])];
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { t as union };
|
|
8
|
-
|
|
1
|
+
import{dedupeBySelector as e}from"../_common/_selectorSet.js";function union(t,n,r){return r?e([...t,...n],r):[...new Set([...t,...n])]}export{union};
|
|
9
2
|
//# sourceMappingURL=union.js.map
|
package/dist/array/union.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of
|
|
1
|
+
{"version":3,"file":"union.js","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of `source` and `other`.\n *\n * Allocates a new `Set` (or selector-keyed dedup structure) and a new result array.\n */\nexport function union<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":"8DAQA,SAAgB,MAAS,EAAsB,EAAqB,EAAwC,CAK1G,OAJK,EAIE,EAAiB,CAAC,GAAG,EAAQ,GAAG,CAAK,EAAG,CAAQ,EAH9C,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAQ,GAAG,CAAK,CAAC,CAAC,CAI7C"}
|
package/dist/array/uniq.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/_selectorSet.cjs");function
|
|
1
|
+
const e=require("../_common/_selectorSet.cjs");function uniq(t,n){return t.length<=1?[...t]:n?e.dedupeBySelector(t,n):[...new Set(t)]}exports.uniq=uniq;
|
|
2
2
|
//# sourceMappingURL=uniq.cjs.map
|
package/dist/array/uniq.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq.cjs","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"+CAkBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"uniq.cjs","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"+CAkBA,SAAgB,KAAQ,EAAqB,EAAwC,CASnF,OARI,EAAM,QAAU,EACX,CAAC,GAAG,CAAK,EAGb,EAIE,EAAA,iBAAiB,EAAO,CAAQ,EAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC,CAI7B"}
|
package/dist/array/uniq.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ import type { Primitive } from '../types';
|
|
|
14
14
|
|
|
15
15
|
* @returns A new duplicate-free array.
|
|
16
16
|
*/
|
|
17
|
-
export declare function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[];
|
|
17
|
+
export declare function uniq<T>(array: readonly T[], selector?: (item: T) => Primitive): T[];
|
|
18
18
|
//# sourceMappingURL=uniq.d.ts.map
|
package/dist/array/uniq.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/array/uniq.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/array/uniq.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAUnF"}
|
package/dist/array/uniq.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/uniq.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
return t.length <= 1 ? [...t] : n ? e(t, n) : [...new Set(t)];
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { t as uniq };
|
|
8
|
-
|
|
1
|
+
import{dedupeBySelector as e}from"../_common/_selectorSet.js";function uniq(t,n){return t.length<=1?[...t]:n?e(t,n):[...new Set(t)]}export{uniq};
|
|
9
2
|
//# sourceMappingURL=uniq.js.map
|
package/dist/array/uniq.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq.js","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uniq.js","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"8DAkBA,SAAgB,KAAQ,EAAqB,EAAwC,CASnF,OARI,EAAM,QAAU,EACX,CAAC,GAAG,CAAK,EAGb,EAIE,EAAiB,EAAO,CAAQ,EAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC,CAI7B"}
|
package/dist/array/unzip.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function unzip(e){if(e.length===0)return[];let t=e[0].length,n=Array.from({length:t},()=>[]);for(let r of e)for(let e=0;e<t;e++)n[e].push(r[e]);return n}exports.unzip=unzip;
|
|
2
2
|
//# sourceMappingURL=unzip.cjs.map
|
package/dist/array/unzip.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unzip.cjs","names":[],"sources":["../../src/array/unzip.ts"],"sourcesContent":["/**\n * Transposes an array of tuples into tuple arrays.\n */\nexport function unzip<T extends readonly unknown[]>(rows: readonly T[]): { [K in keyof T]: Array<T[K]> } {\n if (rows.length === 0) return [] as unknown as { [K in keyof T]: Array<T[K]> };\n\n const width = rows[0].length;\n const out = Array.from({ length: width }, () => [] as unknown[]);\n\n for (const row of rows) {\n for (let index = 0; index < width; index++) {\n out[index].push(row[index]);\n }\n }\n\n return out as { [K in keyof T]: Array<T[K]> };\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"unzip.cjs","names":[],"sources":["../../src/array/unzip.ts"],"sourcesContent":["/**\n * Transposes an array of tuples into tuple arrays.\n */\nexport function unzip<T extends readonly unknown[]>(rows: readonly T[]): { [K in keyof T]: Array<T[K]> } {\n if (rows.length === 0) return [] as unknown as { [K in keyof T]: Array<T[K]> };\n\n const width = rows[0].length;\n const out = Array.from({ length: width }, () => [] as unknown[]);\n\n for (const row of rows) {\n for (let index = 0; index < width; index++) {\n out[index].push(row[index]);\n }\n }\n\n return out as { [K in keyof T]: Array<T[K]> };\n}\n"],"mappings":"AAGA,SAAgB,MAAoC,EAAqD,CACvG,GAAI,EAAK,SAAW,EAAG,MAAO,CAAC,EAE/B,IAAM,EAAQ,EAAK,EAAE,CAAC,OAChB,EAAM,MAAM,KAAK,CAAE,OAAQ,CAAM,MAAS,CAAC,CAAc,EAE/D,IAAK,IAAM,KAAO,EAChB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAO,IACjC,EAAI,EAAM,CAAC,KAAK,EAAI,EAAM,EAI9B,OAAO,CACT"}
|
package/dist/array/unzip.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e) {
|
|
3
|
-
if (e.length === 0) return [];
|
|
4
|
-
let t = e[0].length, n = Array.from({ length: t }, () => []);
|
|
5
|
-
for (let r of e) for (let e = 0; e < t; e++) n[e].push(r[e]);
|
|
6
|
-
return n;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { e as unzip };
|
|
10
|
-
|
|
1
|
+
function unzip(e){if(e.length===0)return[];let t=e[0].length,n=Array.from({length:t},()=>[]);for(let r of e)for(let e=0;e<t;e++)n[e].push(r[e]);return n}export{unzip};
|
|
11
2
|
//# sourceMappingURL=unzip.js.map
|
package/dist/array/unzip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unzip.js","names":[],"sources":["../../src/array/unzip.ts"],"sourcesContent":["/**\n * Transposes an array of tuples into tuple arrays.\n */\nexport function unzip<T extends readonly unknown[]>(rows: readonly T[]): { [K in keyof T]: Array<T[K]> } {\n if (rows.length === 0) return [] as unknown as { [K in keyof T]: Array<T[K]> };\n\n const width = rows[0].length;\n const out = Array.from({ length: width }, () => [] as unknown[]);\n\n for (const row of rows) {\n for (let index = 0; index < width; index++) {\n out[index].push(row[index]);\n }\n }\n\n return out as { [K in keyof T]: Array<T[K]> };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unzip.js","names":[],"sources":["../../src/array/unzip.ts"],"sourcesContent":["/**\n * Transposes an array of tuples into tuple arrays.\n */\nexport function unzip<T extends readonly unknown[]>(rows: readonly T[]): { [K in keyof T]: Array<T[K]> } {\n if (rows.length === 0) return [] as unknown as { [K in keyof T]: Array<T[K]> };\n\n const width = rows[0].length;\n const out = Array.from({ length: width }, () => [] as unknown[]);\n\n for (const row of rows) {\n for (let index = 0; index < width; index++) {\n out[index].push(row[index]);\n }\n }\n\n return out as { [K in keyof T]: Array<T[K]> };\n}\n"],"mappings":"AAGA,SAAgB,MAAoC,EAAqD,CACvG,GAAI,EAAK,SAAW,EAAG,MAAO,CAAC,EAE/B,IAAM,EAAQ,EAAK,EAAE,CAAC,OAChB,EAAM,MAAM,KAAK,CAAE,OAAQ,CAAM,MAAS,CAAC,CAAc,EAE/D,IAAK,IAAM,KAAO,EAChB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAO,IACjC,EAAI,EAAM,CAAC,KAAK,EAAI,EAAM,EAI9B,OAAO,CACT"}
|
package/dist/array/zip.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function zip(...e){if(e.length===0)return[];let t=Math.max(...e.map(e=>e.length)),n=Array(t);for(let r=0;r<t;r++)n[r]=e.map(e=>e[r]);return n}exports.zip=zip;
|
|
2
2
|
//# sourceMappingURL=zip.cjs.map
|
package/dist/array/zip.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.cjs","names":[],"sources":["../../src/array/zip.ts"],"sourcesContent":["/**\n * Zips multiple arrays by index.\n */\nexport function zip<T extends readonly unknown[][]>(\n ...arrays: T\n): Array<{ [K in keyof T]: T[K] extends readonly (infer U)[] ? U | undefined : never }> {\n if (arrays.length === 0) return [];\n\n const length = Math.max(...arrays.map((arr) => arr.length));\n const out = new Array(length);\n\n for (let index = 0; index < length; index++) {\n out[index] = arrays.map((array) => array[index]);\n }\n\n return out as Array<{ [K in keyof T]: T[K] extends readonly (infer U)[] ? U | undefined : never }>;\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"zip.cjs","names":[],"sources":["../../src/array/zip.ts"],"sourcesContent":["/**\n * Zips multiple arrays by index.\n */\nexport function zip<T extends readonly (readonly unknown[])[]>(\n ...arrays: T\n): Array<{ [K in keyof T]: T[K] extends readonly (infer U)[] ? U | undefined : never }> {\n if (arrays.length === 0) return [];\n\n const length = Math.max(...arrays.map((arr) => arr.length));\n const out = new Array(length);\n\n for (let index = 0; index < length; index++) {\n out[index] = arrays.map((array) => array[index]);\n }\n\n return out as Array<{ [K in keyof T]: T[K] extends readonly (infer U)[] ? U | undefined : never }>;\n}\n"],"mappings":"AAGA,SAAgB,IACd,GAAG,EACmF,CACtF,GAAI,EAAO,SAAW,EAAG,MAAO,CAAC,EAEjC,IAAM,EAAS,KAAK,IAAI,GAAG,EAAO,IAAK,GAAQ,EAAI,MAAM,CAAC,EACpD,EAAU,MAAM,CAAM,EAE5B,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAQ,IAClC,EAAI,GAAS,EAAO,IAAK,GAAU,EAAM,EAAM,EAGjD,OAAO,CACT"}
|
package/dist/array/zip.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zips multiple arrays by index.
|
|
3
3
|
*/
|
|
4
|
-
export declare function zip<T extends readonly unknown[][]>(...arrays: T): Array<{
|
|
4
|
+
export declare function zip<T extends readonly (readonly unknown[])[]>(...arrays: T): Array<{
|
|
5
5
|
[K in keyof T]: T[K] extends readonly (infer U)[] ? U | undefined : never;
|
|
6
6
|
}>;
|
|
7
7
|
//# sourceMappingURL=zip.d.ts.map
|