@vielzeug/arsenal 3.0.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/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.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.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.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.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.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.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.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.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.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.js +1 -13
- package/dist/array/groupBy.js.map +1 -1
- package/dist/array/index.js +1 -28
- package/dist/array/indexBy.cjs +1 -1
- package/dist/array/indexBy.cjs.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.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.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.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.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.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.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.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.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.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.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.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.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.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.js +1 -59
- 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.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.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.js +1 -8
- 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.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.js +1 -7
- 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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -35
- 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.js +1 -8
- 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.js +1 -13
- package/dist/math/gcd.js.map +1 -1
- package/dist/math/index.js +1 -16
- package/dist/math/lcm.cjs +1 -1
- package/dist/math/lcm.cjs.map +1 -1
- package/dist/math/lcm.js +1 -12
- 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.js +1 -11
- 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.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.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.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.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.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.js +1 -33
- 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.js +1 -8
- 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.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 +1 -1
- package/dist/random/source.cjs.map +1 -1
- package/dist/random/source.js +1 -9
- package/dist/random/source.js.map +1 -1
- 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.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 +1 -1
- package/dist/string/padCenter.cjs.map +1 -1
- package/dist/string/padCenter.js +1 -9
- package/dist/string/padCenter.js.map +1 -1
- 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 +13 -5
package/dist/array/first.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first.cjs","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"first.cjs","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,MAAS,EAAqB,EAA6B,CACzE,OAAO,EAAM,OAAS,EAAI,EAAM,GAAK,CACvC"}
|
package/dist/array/first.js
CHANGED
package/dist/array/first.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first.js","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"first.js","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,MAAS,EAAqB,EAA6B,CACzE,OAAO,EAAM,OAAS,EAAI,EAAM,GAAK,CACvC"}
|
package/dist/array/groupBy.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/unsafePaths.cjs");function
|
|
1
|
+
const e=require("../_common/unsafePaths.cjs");function groupBy(t,n){let r={};for(let i of t){let t=n(i),a=t==null?`_`:String(t);e.isUnsafeKey(a)||(r[a]||(r[a]=[]),r[a].push(i))}return r}exports.groupBy=groupBy;
|
|
2
2
|
//# sourceMappingURL=groupBy.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupBy.cjs","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,
|
|
1
|
+
{"version":3,"file":"groupBy.cjs","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,QAAW,EAAqB,EAAuD,CACrG,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAS,EAAS,CAAI,EACtB,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAA,YAAY,CAAG,IAEd,EAAO,KACV,EAAO,GAAO,CAAC,GAGjB,EAAO,EAAI,CAAC,KAAK,CAAI,EACvB,CAEA,OAAO,CACT"}
|
package/dist/array/groupBy.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/groupBy.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
let r = {};
|
|
5
|
-
for (let i of t) {
|
|
6
|
-
let t = n(i), a = t == null ? "_" : String(t);
|
|
7
|
-
e(a) || (r[a] || (r[a] = []), r[a].push(i));
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as groupBy };
|
|
13
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";function groupBy(t,n){let r={};for(let i of t){let t=n(i),a=t==null?`_`:String(t);e(a)||(r[a]||(r[a]=[]),r[a].push(i))}return r}export{groupBy};
|
|
14
2
|
//# sourceMappingURL=groupBy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupBy.js","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"groupBy.js","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"wDAOA,SAAgB,QAAW,EAAqB,EAAuD,CACrG,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAS,EAAS,CAAI,EACtB,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAY,CAAG,IAEd,EAAO,KACV,EAAO,GAAO,CAAC,GAGjB,EAAO,EAAI,CAAC,KAAK,CAAI,EACvB,CAEA,OAAO,CACT"}
|
package/dist/array/index.js
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { compact as t } from "./compact.js";
|
|
3
|
-
import { compare as n } from "./compare.js";
|
|
4
|
-
import { compareBy as r } from "./compareBy.js";
|
|
5
|
-
import { contains as i } from "./contains.js";
|
|
6
|
-
import { countBy as a } from "./countBy.js";
|
|
7
|
-
import { difference as o } from "./difference.js";
|
|
8
|
-
import { drop as s } from "./drop.js";
|
|
9
|
-
import { dropLast as c } from "./dropLast.js";
|
|
10
|
-
import { filterMap as l } from "./filterMap.js";
|
|
11
|
-
import { first as u } from "./first.js";
|
|
12
|
-
import { groupBy as d } from "./groupBy.js";
|
|
13
|
-
import { indexBy as f } from "./indexBy.js";
|
|
14
|
-
import { intersection as p } from "./intersection.js";
|
|
15
|
-
import { last as m } from "./last.js";
|
|
16
|
-
import { partition as h } from "./partition.js";
|
|
17
|
-
import { replace as g } from "./replace.js";
|
|
18
|
-
import { rotate as _ } from "./rotate.js";
|
|
19
|
-
import { fuzzyFilter as v, fuzzyScore as y } from "./search.js";
|
|
20
|
-
import { sort as b } from "./sort.js";
|
|
21
|
-
import { take as x } from "./take.js";
|
|
22
|
-
import { takeLast as S } from "./takeLast.js";
|
|
23
|
-
import { toggle as C } from "./toggle.js";
|
|
24
|
-
import { union as w } from "./union.js";
|
|
25
|
-
import { uniq as T } from "./uniq.js";
|
|
26
|
-
import { unzip as E } from "./unzip.js";
|
|
27
|
-
import { zip as D } from "./zip.js";
|
|
28
|
-
export { e as chunk, t as compact, n as compare, r as compareBy, i as contains, a as countBy, o as difference, s as drop, c as dropLast, l as filterMap, u as first, v as fuzzyFilter, y as fuzzyScore, d as groupBy, f as indexBy, p as intersection, m as last, h as partition, g as replace, _ as rotate, b as sort, x as take, S as takeLast, C as toggle, w as union, T as uniq, E as unzip, D as zip };
|
|
1
|
+
import{chunk as e}from"./chunk.js";import{compact as t}from"./compact.js";import{compare as n}from"./compare.js";import{compareBy as r}from"./compareBy.js";import{contains as i}from"./contains.js";import{countBy as a}from"./countBy.js";import{difference as o}from"./difference.js";import{drop as s}from"./drop.js";import{dropLast as c}from"./dropLast.js";import{filterMap as l}from"./filterMap.js";import{first as u}from"./first.js";import{groupBy as d}from"./groupBy.js";import{indexBy as f}from"./indexBy.js";import{intersection as p}from"./intersection.js";import{last as m}from"./last.js";import{partition as h}from"./partition.js";import{replace as g}from"./replace.js";import{rotate as _}from"./rotate.js";import{fuzzyFilter as v,fuzzyScore as y}from"./search.js";import{sort as b}from"./sort.js";import{take as x}from"./take.js";import{takeLast as S}from"./takeLast.js";import{toggle as C}from"./toggle.js";import{union as w}from"./union.js";import{uniq as T}from"./uniq.js";import{unzip as E}from"./unzip.js";import{zip as D}from"./zip.js";export{e as chunk,t as compact,n as compare,r as compareBy,i as contains,a as countBy,o as difference,s as drop,c as dropLast,l as filterMap,u as first,v as fuzzyFilter,y as fuzzyScore,d as groupBy,f as indexBy,p as intersection,m as last,h as partition,g as replace,_ as rotate,b as sort,x as take,S as takeLast,C as toggle,w as union,T as uniq,E as unzip,D as zip};
|
package/dist/array/indexBy.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/unsafePaths.cjs");function
|
|
1
|
+
const e=require("../_common/unsafePaths.cjs");function indexBy(t,n){let r={};for(let i of t){let t=String(n(i));e.isUnsafeKey(t)||(r[t]=i)}return r}exports.indexBy=indexBy;
|
|
2
2
|
//# sourceMappingURL=indexBy.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexBy.cjs","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,
|
|
1
|
+
{"version":3,"file":"indexBy.cjs","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,QAAW,EAAqB,EAAqD,CACnG,IAAM,EAA4B,CAAC,EAEnC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,OAAO,EAAS,CAAI,CAAC,EAE7B,EAAA,YAAY,CAAG,IAEnB,EAAO,GAAO,EAChB,CAEA,OAAO,CACT"}
|
package/dist/array/indexBy.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/indexBy.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
let r = {};
|
|
5
|
-
for (let i of t) {
|
|
6
|
-
let t = String(n(i));
|
|
7
|
-
e(t) || (r[t] = i);
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as indexBy };
|
|
13
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";function indexBy(t,n){let r={};for(let i of t){let t=String(n(i));e(t)||(r[t]=i)}return r}export{indexBy};
|
|
14
2
|
//# sourceMappingURL=indexBy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexBy.js","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexBy.js","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"wDAOA,SAAgB,QAAW,EAAqB,EAAqD,CACnG,IAAM,EAA4B,CAAC,EAEnC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,OAAO,EAAS,CAAI,CAAC,EAE7B,EAAY,CAAG,IAEnB,EAAO,GAAO,EAChB,CAEA,OAAO,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/_selectorSet.cjs");function
|
|
1
|
+
const e=require("../_common/_selectorSet.cjs");function intersection(t,n,r){if(!r){let e=new Set(n);return t.filter(t=>e.has(t))}let i=e.toSelectorSet(n,r);return t.filter(e=>i.has(r(e)))}exports.intersection=intersection;
|
|
2
2
|
//# sourceMappingURL=intersection.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"+CAQA,SAAgB,
|
|
1
|
+
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"+CAQA,SAAgB,aAAgB,EAAsB,EAAqB,EAAwC,CACjH,GAAI,CAAC,EAAU,CACb,IAAM,EAAQ,IAAI,IAAI,CAAK,EAE3B,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAQ,EAAA,cAAc,EAAO,CAAQ,EAE3C,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/array/intersection.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
if (!r) {
|
|
5
|
-
let e = new Set(n);
|
|
6
|
-
return t.filter((t) => e.has(t));
|
|
7
|
-
}
|
|
8
|
-
let i = e(n, r);
|
|
9
|
-
return t.filter((e) => i.has(r(e)));
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as intersection };
|
|
13
|
-
|
|
1
|
+
import{toSelectorSet as e}from"../_common/_selectorSet.js";function intersection(t,n,r){if(!r){let e=new Set(n);return t.filter(t=>e.has(t))}let i=e(n,r);return t.filter(e=>i.has(r(e)))}export{intersection};
|
|
14
2
|
//# sourceMappingURL=intersection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"2DAQA,SAAgB,aAAgB,EAAsB,EAAqB,EAAwC,CACjH,GAAI,CAAC,EAAU,CACb,IAAM,EAAQ,IAAI,IAAI,CAAK,EAE3B,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAQ,EAAc,EAAO,CAAQ,EAE3C,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
|
package/dist/array/last.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function last(e,t){return e.length>0?e[e.length-1]:t}exports.last=last;
|
|
2
2
|
//# sourceMappingURL=last.cjs.map
|
package/dist/array/last.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last.cjs","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,
|
|
1
|
+
{"version":3,"file":"last.cjs","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,KAAQ,EAAqB,EAA6B,CACxE,OAAO,EAAM,OAAS,EAAI,EAAM,EAAM,OAAS,GAAK,CACtD"}
|
package/dist/array/last.js
CHANGED
package/dist/array/last.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last.js","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"last.js","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,KAAQ,EAAqB,EAA6B,CACxE,OAAO,EAAM,OAAS,EAAI,EAAM,EAAM,OAAS,GAAK,CACtD"}
|
package/dist/array/partition.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function partition(e,t){let n=[],r=[];for(let i=0;i<e.length;i++)t(e[i],i,e)?n.push(e[i]):r.push(e[i]);return[n,r]}exports.partition=partition;
|
|
2
2
|
//# sourceMappingURL=partition.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition.cjs","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n"],"mappings":"AAKA,SAAgB,
|
|
1
|
+
{"version":3,"file":"partition.cjs","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n"],"mappings":"AAKA,SAAgB,UACd,EACA,EACY,CACZ,IAAM,EAAgB,CAAC,EACjB,EAAgB,CAAC,EAEvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IACpC,EAAU,EAAM,GAAQ,EAAO,CAAK,EACtC,EAAS,KAAK,EAAM,EAAM,EAE1B,EAAS,KAAK,EAAM,EAAM,EAI9B,MAAO,CAAC,EAAU,CAAQ,CAC5B"}
|
package/dist/array/partition.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e, t) {
|
|
3
|
-
let n = [], r = [];
|
|
4
|
-
for (let i = 0; i < e.length; i++) t(e[i], i, e) ? n.push(e[i]) : r.push(e[i]);
|
|
5
|
-
return [n, r];
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { e as partition };
|
|
9
|
-
|
|
1
|
+
function partition(e,t){let n=[],r=[];for(let i=0;i<e.length;i++)t(e[i],i,e)?n.push(e[i]):r.push(e[i]);return[n,r]}export{partition};
|
|
10
2
|
//# sourceMappingURL=partition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition.js","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"partition.js","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n"],"mappings":"AAKA,SAAgB,UACd,EACA,EACY,CACZ,IAAM,EAAgB,CAAC,EACjB,EAAgB,CAAC,EAEvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IACpC,EAAU,EAAM,GAAQ,EAAO,CAAK,EACtC,EAAS,KAAK,EAAM,EAAM,EAE1B,EAAS,KAAK,EAAM,EAAM,EAI9B,MAAO,CAAC,EAAU,CAAQ,CAC5B"}
|
package/dist/array/replace.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function replace(e,t,n){let r=e.findIndex(t);return r===-1?e:[...e.slice(0,r),n,...e.slice(r+1)]}exports.replace=replace;
|
|
2
2
|
//# sourceMappingURL=replace.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.cjs","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,
|
|
1
|
+
{"version":3,"file":"replace.cjs","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/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/** 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":"
|
|
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":["/** 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,
|
|
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.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":["/** 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":"
|
|
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: 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,
|
|
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.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: 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":"
|
|
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: 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,
|
|
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.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: readonly 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: 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,
|
|
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.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: 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":"
|
|
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: 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,
|
|
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.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: 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":"
|
|
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
|