@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/object/merge.js
CHANGED
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isPlainObject as t } from "../guards/isPlainObject.js";
|
|
3
|
-
//#region src/object/merge.ts
|
|
4
|
-
function n(r, i, a) {
|
|
5
|
-
if (!t(i)) return i;
|
|
6
|
-
let o = { ...r };
|
|
7
|
-
for (let r of Object.keys(i)) {
|
|
8
|
-
if (e(r)) continue;
|
|
9
|
-
let s = i[r], c = o[r];
|
|
10
|
-
o[r] = Array.isArray(s) && Array.isArray(c) ? a.arrayStrategy === "concat" ? [...c, ...s] : s : t(s) && t(c) ? n(c, s, a) : s;
|
|
11
|
-
}
|
|
12
|
-
return o;
|
|
13
|
-
}
|
|
14
|
-
function r(e, t = {}) {
|
|
15
|
-
return e.reduce((e, r) => n(e, r, t), {});
|
|
16
|
-
}
|
|
17
|
-
function i(...t) {
|
|
18
|
-
if (t.length === 0) return {};
|
|
19
|
-
let n = {};
|
|
20
|
-
for (let r of t) for (let t of Object.keys(r)) e(t) || (n[t] = r[t]);
|
|
21
|
-
return n;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { r as deepMerge, i as shallowMerge };
|
|
25
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";import{isPlainObject as t}from"../guards/isPlainObject.js";function mergeObjects(n,r,i){if(!t(r))return r;let a={...n};for(let n of Object.keys(r)){if(e(n))continue;let o=r[n],s=a[n];a[n]=Array.isArray(o)&&Array.isArray(s)?i.arrayStrategy===`concat`?[...s,...o]:o:t(o)&&t(s)?mergeObjects(s,o,i):o}return a}function deepMerge(e,t={}){return e.reduce((e,n)=>mergeObjects(e,n,t),{})}function shallowMerge(...t){if(t.length===0)return{};let n={};for(let r of t)for(let t of Object.keys(r))e(t)||(n[t]=r[t]);return n}export{deepMerge,shallowMerge};
|
|
26
2
|
//# sourceMappingURL=merge.js.map
|
package/dist/object/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","names":[],"sources":["../../src/object/merge.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\nexport type DeepMergeOptions = {\n /** How to handle arrays when both source and target contain one. Default: `'replace'`. */\n arrayStrategy?: 'concat' | 'replace';\n};\n\ntype DeepMerge<T, U> = T extends Obj\n ? U extends Obj\n ? {\n [K in keyof T | keyof U]: K extends keyof T\n ? K extends keyof U\n ? DeepMerge<T[K], U[K]>\n : T[K]\n : K extends keyof U\n ? U[K]\n : never;\n }\n : U\n : U;\n\ntype Merge<T extends Obj[]> = T extends [infer First, ...infer Rest]\n ? First extends Obj\n ? Rest extends Obj[]\n ? DeepMerge<First, Merge<Rest>>\n : First\n : Obj\n : Obj;\n\nfunction mergeObjects<T extends Obj, U extends Obj>(target: T, source: U, options: DeepMergeOptions): DeepMerge<T, U> {\n if (!isPlainObject(source)) return source as DeepMerge<T, U>;\n\n const result = { ...target } as DeepMerge<T, U>;\n\n for (const key of Object.keys(source)) {\n // Guard against prototype pollution: skip dangerous keys\n if (isUnsafeKey(key)) {\n continue;\n }\n\n const sourceValue = source[key];\n const targetValue = result[key];\n\n (result as Record<string, unknown>)[key] =\n Array.isArray(sourceValue) && Array.isArray(targetValue)\n ? options.arrayStrategy === 'concat'\n ? [...targetValue, ...sourceValue]\n : sourceValue\n : isPlainObject(sourceValue) && isPlainObject(targetValue)\n ? mergeObjects(targetValue as Obj, sourceValue as Obj, options)\n : sourceValue;\n }\n\n return result;\n}\n\n/**\n * Deeply merges two or more objects. Arrays in source objects **replace** the target array by default.\n * Pass `{ arrayStrategy: 'concat' }` as the last argument to concatenate arrays instead.\n *\n * @example\n * ```ts\n * deepMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 });\n * // { a: 1, b: { x: 1, y: 2 }, c: 3 }\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] });\n * // { tags: ['b'] } ← arrays replaced\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] }, { arrayStrategy: 'concat' });\n * // { tags: ['a', 'b'] }\n * ```\n */\nexport function deepMerge<T extends Obj[]>(items: readonly [...T], options: DeepMergeOptions = {}): Merge<T> {\n return items.reduce((acc: Obj, item) => mergeObjects(acc, item, options) as Obj, {} as Obj) as Merge<T>;\n}\n\n/**\n * Shallowly merges two or more objects. Later sources win for duplicate keys.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * shallowMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 } });\n * // { a: 1, b: { y: 2 } } ← nested object replaced, not merged\n *\n * shallowMerge(defaults, overrides, extras);\n * ```\n */\nexport function shallowMerge<T extends Obj[]>(...items: [...T]): Merge<T> {\n if (items.length === 0) return {} as Merge<T>;\n\n const result: Obj = {};\n\n for (const item of items) {\n for (const key of Object.keys(item)) {\n if (isUnsafeKey(key)) continue;\n\n result[key] = item[key];\n }\n }\n\n return result as Merge<T>;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.js","names":[],"sources":["../../src/object/merge.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\nexport type DeepMergeOptions = {\n /** How to handle arrays when both source and target contain one. Default: `'replace'`. */\n arrayStrategy?: 'concat' | 'replace';\n};\n\ntype DeepMerge<T, U> = T extends Obj\n ? U extends Obj\n ? {\n [K in keyof T | keyof U]: K extends keyof T\n ? K extends keyof U\n ? DeepMerge<T[K], U[K]>\n : T[K]\n : K extends keyof U\n ? U[K]\n : never;\n }\n : U\n : U;\n\ntype Merge<T extends Obj[]> = T extends [infer First, ...infer Rest]\n ? First extends Obj\n ? Rest extends Obj[]\n ? DeepMerge<First, Merge<Rest>>\n : First\n : Obj\n : Obj;\n\nfunction mergeObjects<T extends Obj, U extends Obj>(target: T, source: U, options: DeepMergeOptions): DeepMerge<T, U> {\n if (!isPlainObject(source)) return source as DeepMerge<T, U>;\n\n const result = { ...target } as DeepMerge<T, U>;\n\n for (const key of Object.keys(source)) {\n // Guard against prototype pollution: skip dangerous keys\n if (isUnsafeKey(key)) {\n continue;\n }\n\n const sourceValue = source[key];\n const targetValue = result[key];\n\n (result as Record<string, unknown>)[key] =\n Array.isArray(sourceValue) && Array.isArray(targetValue)\n ? options.arrayStrategy === 'concat'\n ? [...targetValue, ...sourceValue]\n : sourceValue\n : isPlainObject(sourceValue) && isPlainObject(targetValue)\n ? mergeObjects(targetValue as Obj, sourceValue as Obj, options)\n : sourceValue;\n }\n\n return result;\n}\n\n/**\n * Deeply merges two or more objects. Arrays in source objects **replace** the target array by default.\n * Pass `{ arrayStrategy: 'concat' }` as the last argument to concatenate arrays instead.\n *\n * @example\n * ```ts\n * deepMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 });\n * // { a: 1, b: { x: 1, y: 2 }, c: 3 }\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] });\n * // { tags: ['b'] } ← arrays replaced\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] }, { arrayStrategy: 'concat' });\n * // { tags: ['a', 'b'] }\n * ```\n */\nexport function deepMerge<T extends Obj[]>(items: readonly [...T], options: DeepMergeOptions = {}): Merge<T> {\n return items.reduce((acc: Obj, item) => mergeObjects(acc, item, options) as Obj, {} as Obj) as Merge<T>;\n}\n\n/**\n * Shallowly merges two or more objects. Later sources win for duplicate keys.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * shallowMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 } });\n * // { a: 1, b: { y: 2 } } ← nested object replaced, not merged\n *\n * shallowMerge(defaults, overrides, extras);\n * ```\n */\nexport function shallowMerge<T extends Obj[]>(...items: [...T]): Merge<T> {\n if (items.length === 0) return {} as Merge<T>;\n\n const result: Obj = {};\n\n for (const item of items) {\n for (const key of Object.keys(item)) {\n if (isUnsafeKey(key)) continue;\n\n result[key] = item[key];\n }\n }\n\n return result as Merge<T>;\n}\n"],"mappings":"mHA+BA,SAAS,aAA2C,EAAW,EAAW,EAA4C,CACpH,GAAI,CAAC,EAAc,CAAM,EAAG,OAAO,EAEnC,IAAM,EAAS,CAAE,GAAG,CAAO,EAE3B,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,EAAG,CAErC,GAAI,EAAY,CAAG,EACjB,SAGF,IAAM,EAAc,EAAO,GACrB,EAAc,EAAO,GAE3B,EAAoC,GAClC,MAAM,QAAQ,CAAW,GAAK,MAAM,QAAQ,CAAW,EACnD,EAAQ,gBAAkB,SACxB,CAAC,GAAG,EAAa,GAAG,CAAW,EAC/B,EACF,EAAc,CAAW,GAAK,EAAc,CAAW,EACrD,aAAa,EAAoB,EAAoB,CAAO,EAC5D,CACV,CAEA,OAAO,CACT,CAkBA,SAAgB,UAA2B,EAAwB,EAA4B,CAAC,EAAa,CAC3G,OAAO,EAAM,QAAQ,EAAU,IAAS,aAAa,EAAK,EAAM,CAAO,EAAU,CAAC,CAAQ,CAC5F,CAcA,SAAgB,aAA8B,GAAG,EAAyB,CACxE,GAAI,EAAM,SAAW,EAAG,MAAO,CAAC,EAEhC,IAAM,EAAc,CAAC,EAErB,IAAK,IAAM,KAAQ,EACjB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAI,EAC5B,EAAY,CAAG,IAEnB,EAAO,GAAO,EAAK,IAIvB,OAAO,CACT"}
|
package/dist/object/omit.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/unsafePaths.cjs");function
|
|
1
|
+
const e=require("../_common/unsafePaths.cjs");function omit(t,n){let r=new Set(n),i={};for(let n of Object.keys(t))e.isUnsafeKey(n)||r.has(n)||(i[n]=t[n]);return i}exports.omit=omit;
|
|
2
2
|
//# sourceMappingURL=omit.cjs.map
|
package/dist/object/omit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.cjs","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAgBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"omit.cjs","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAgBA,SAAgB,KAAuC,EAAQ,EAAuC,CACpG,IAAM,EAAY,IAAI,IAAiB,CAAqC,EACtE,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAA,YAAY,CAAkB,GAE7B,EAAU,IAAI,CAAG,IACpB,EAAW,GAAO,EAAI,IAI1B,OAAO,CACT"}
|
package/dist/object/omit.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/object/omit.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
let r = new Set(n), i = {};
|
|
5
|
-
for (let n of Object.keys(t)) e(n) || r.has(n) || (i[n] = t[n]);
|
|
6
|
-
return i;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { t as omit };
|
|
10
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";function omit(t,n){let r=new Set(n),i={};for(let n of Object.keys(t))e(n)||r.has(n)||(i[n]=t[n]);return i}export{omit};
|
|
11
2
|
//# sourceMappingURL=omit.js.map
|
package/dist/object/omit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"omit.js","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"wDAgBA,SAAgB,KAAuC,EAAQ,EAAuC,CACpG,IAAM,EAAY,IAAI,IAAiB,CAAqC,EACtE,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAY,CAAkB,GAE7B,EAAU,IAAI,CAAG,IACpB,EAAW,GAAO,EAAI,IAI1B,OAAO,CACT"}
|
package/dist/object/pick.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/unsafePaths.cjs");function
|
|
1
|
+
const e=require("../_common/unsafePaths.cjs");function pick(t,n){let r={};for(let i of n)e.isUnsafeKey(i)||Object.hasOwn(t,i)&&(r[i]=t[i]);return r}exports.pick=pick;
|
|
2
2
|
//# sourceMappingURL=pick.cjs.map
|
package/dist/object/pick.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.cjs","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAiBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"pick.cjs","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAiBA,SAAgB,KAAuC,EAAQ,EAAwC,CACrG,IAAM,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,EACZ,EAAA,YAAY,CAAkB,GAE9B,OAAO,OAAO,EAAK,CAAG,IACxB,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
|
package/dist/object/pick.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/object/pick.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
let r = {};
|
|
5
|
-
for (let i of n) e(i) || Object.hasOwn(t, i) && (r[i] = t[i]);
|
|
6
|
-
return r;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { t as pick };
|
|
10
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";function pick(t,n){let r={};for(let i of n)e(i)||Object.hasOwn(t,i)&&(r[i]=t[i]);return r}export{pick};
|
|
11
2
|
//# sourceMappingURL=pick.js.map
|
package/dist/object/pick.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.js","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pick.js","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"wDAiBA,SAAgB,KAAuC,EAAQ,EAAwC,CACrG,IAAM,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,EACZ,EAAY,CAAkB,GAE9B,OAAO,OAAO,EAAK,CAAG,IACxB,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
|
package/dist/object/prune.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../_common/unsafePaths.cjs"),t=require("../array/filterMap.cjs"),n=require("../guards/isPlainObject.cjs"),r=require("../guards/isEmpty.cjs");function i
|
|
1
|
+
const e=require("../_common/unsafePaths.cjs"),t=require("../array/filterMap.cjs"),n=require("../guards/isPlainObject.cjs"),r=require("../guards/isEmpty.cjs");function prune(i){if(i!=null){if(typeof i==`string`){let e=i.trim();return e===``?void 0:e}if(Array.isArray(i)){let e=t.filterMap(i,e=>{let t=prune(e);return r.isEmpty(t)?void 0:t});return e.length===0?void 0:e}if(n.isPlainObject(i)){let t={};for(let[n,a]of Object.entries(i)){if(e.isUnsafeKey(n))continue;let i=prune(a);r.isEmpty(i)||(t[n]=i)}return Object.keys(t).length===0?void 0:t}return i}}exports.prune=prune;
|
|
2
2
|
//# sourceMappingURL=prune.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune.cjs","names":[],"sources":["../../src/object/prune.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { filterMap } from '../array/filterMap';\nimport { isEmpty } from '../guards/isEmpty';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: trims whitespace and returns `undefined` if the result is empty.\n * - For arrays: recursively removes `null`, `undefined`, empty strings, and empty objects/arrays.\n * - For objects: recursively removes properties whose pruned value is empty. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n * - For any other type: returns the value unchanged.\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune.\n * @returns The pruned value, or `undefined` if the result would be empty.\n */\nexport function prune(value: string): string | undefined;\nexport function prune<T>(value: T[]): Array<NonNullable<T>> | undefined;\nexport function prune<T extends Record<string, unknown>>(value: T): Partial<T> | undefined;\nexport function prune<T>(value: T): T | undefined;\nexport function prune<T>(value: T): T | undefined {\n if (value === null || value === undefined) return undefined;\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n if (Array.isArray(value)) {\n const cleaned = filterMap(value as unknown[], (item) => {\n const pruned = prune(item);\n\n return isEmpty(pruned) ? undefined : (pruned as unknown);\n });\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n if (isPlainObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n if (isUnsafeKey(key)) continue;\n\n const cleanedValue = prune(val);\n\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n return value;\n}\n"],"mappings":"8JA8BA,SAAgB,
|
|
1
|
+
{"version":3,"file":"prune.cjs","names":[],"sources":["../../src/object/prune.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { filterMap } from '../array/filterMap';\nimport { isEmpty } from '../guards/isEmpty';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: trims whitespace and returns `undefined` if the result is empty.\n * - For arrays: recursively removes `null`, `undefined`, empty strings, and empty objects/arrays.\n * - For objects: recursively removes properties whose pruned value is empty. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n * - For any other type: returns the value unchanged.\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune.\n * @returns The pruned value, or `undefined` if the result would be empty.\n */\nexport function prune(value: string): string | undefined;\nexport function prune<T>(value: T[]): Array<NonNullable<T>> | undefined;\nexport function prune<T extends Record<string, unknown>>(value: T): Partial<T> | undefined;\nexport function prune<T>(value: T): T | undefined;\nexport function prune<T>(value: T): T | undefined {\n if (value === null || value === undefined) return undefined;\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n if (Array.isArray(value)) {\n const cleaned = filterMap(value as unknown[], (item) => {\n const pruned = prune(item);\n\n return isEmpty(pruned) ? undefined : (pruned as unknown);\n });\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n if (isPlainObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n if (isUnsafeKey(key)) continue;\n\n const cleanedValue = prune(val);\n\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n return value;\n}\n"],"mappings":"8JA8BA,SAAgB,MAAS,EAAyB,CAC5C,MAAU,KAEd,IAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAU,EAAM,KAAK,EAE3B,OAAQ,IAAY,GAAK,IAAA,GAAY,CACvC,CAEA,GAAI,MAAM,QAAQ,CAAK,EAAG,CACxB,IAAM,EAAU,EAAA,UAAU,EAAqB,GAAS,CACtD,IAAM,EAAS,MAAM,CAAI,EAEzB,OAAO,EAAA,QAAQ,CAAM,EAAI,IAAA,GAAa,CACxC,CAAC,EAED,OAAQ,EAAQ,SAAW,EAAI,IAAA,GAAY,CAC7C,CAEA,GAAI,EAAA,cAAc,CAAK,EAAG,CACxB,IAAM,EAAmC,CAAC,EAE1C,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAK,EAAG,CAC9C,GAAI,EAAA,YAAY,CAAG,EAAG,SAEtB,IAAM,EAAe,MAAM,CAAG,EAEzB,EAAA,QAAQ,CAAY,IACvB,EAAQ,GAAO,EAEnB,CAEA,OAAQ,OAAO,KAAK,CAAO,CAAC,CAAC,SAAW,EAAI,IAAA,GAAY,CAC1D,CAEA,OAAO,CA5BP,CA6BF"}
|
package/dist/object/prune.js
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { filterMap as t } from "../array/filterMap.js";
|
|
3
|
-
import { isPlainObject as n } from "../guards/isPlainObject.js";
|
|
4
|
-
import { isEmpty as r } from "../guards/isEmpty.js";
|
|
5
|
-
//#region src/object/prune.ts
|
|
6
|
-
function i(a) {
|
|
7
|
-
if (a != null) {
|
|
8
|
-
if (typeof a == "string") {
|
|
9
|
-
let e = a.trim();
|
|
10
|
-
return e === "" ? void 0 : e;
|
|
11
|
-
}
|
|
12
|
-
if (Array.isArray(a)) {
|
|
13
|
-
let e = t(a, (e) => {
|
|
14
|
-
let t = i(e);
|
|
15
|
-
return r(t) ? void 0 : t;
|
|
16
|
-
});
|
|
17
|
-
return e.length === 0 ? void 0 : e;
|
|
18
|
-
}
|
|
19
|
-
if (n(a)) {
|
|
20
|
-
let t = {};
|
|
21
|
-
for (let [n, o] of Object.entries(a)) {
|
|
22
|
-
if (e(n)) continue;
|
|
23
|
-
let a = i(o);
|
|
24
|
-
r(a) || (t[n] = a);
|
|
25
|
-
}
|
|
26
|
-
return Object.keys(t).length === 0 ? void 0 : t;
|
|
27
|
-
}
|
|
28
|
-
return a;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { i as prune };
|
|
33
|
-
|
|
1
|
+
import{isUnsafeKey as e}from"../_common/unsafePaths.js";import{filterMap as t}from"../array/filterMap.js";import{isPlainObject as n}from"../guards/isPlainObject.js";import{isEmpty as r}from"../guards/isEmpty.js";function prune(i){if(i!=null){if(typeof i==`string`){let e=i.trim();return e===``?void 0:e}if(Array.isArray(i)){let e=t(i,e=>{let t=prune(e);return r(t)?void 0:t});return e.length===0?void 0:e}if(n(i)){let t={};for(let[n,a]of Object.entries(i)){if(e(n))continue;let i=prune(a);r(i)||(t[n]=i)}return Object.keys(t).length===0?void 0:t}return i}}export{prune};
|
|
34
2
|
//# sourceMappingURL=prune.js.map
|
package/dist/object/prune.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune.js","names":[],"sources":["../../src/object/prune.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { filterMap } from '../array/filterMap';\nimport { isEmpty } from '../guards/isEmpty';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: trims whitespace and returns `undefined` if the result is empty.\n * - For arrays: recursively removes `null`, `undefined`, empty strings, and empty objects/arrays.\n * - For objects: recursively removes properties whose pruned value is empty. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n * - For any other type: returns the value unchanged.\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune.\n * @returns The pruned value, or `undefined` if the result would be empty.\n */\nexport function prune(value: string): string | undefined;\nexport function prune<T>(value: T[]): Array<NonNullable<T>> | undefined;\nexport function prune<T extends Record<string, unknown>>(value: T): Partial<T> | undefined;\nexport function prune<T>(value: T): T | undefined;\nexport function prune<T>(value: T): T | undefined {\n if (value === null || value === undefined) return undefined;\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n if (Array.isArray(value)) {\n const cleaned = filterMap(value as unknown[], (item) => {\n const pruned = prune(item);\n\n return isEmpty(pruned) ? undefined : (pruned as unknown);\n });\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n if (isPlainObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n if (isUnsafeKey(key)) continue;\n\n const cleanedValue = prune(val);\n\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n return value;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prune.js","names":[],"sources":["../../src/object/prune.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { filterMap } from '../array/filterMap';\nimport { isEmpty } from '../guards/isEmpty';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Removes all nullable and empty values from strings, arrays, or objects.\n *\n * - For strings: trims whitespace and returns `undefined` if the result is empty.\n * - For arrays: recursively removes `null`, `undefined`, empty strings, and empty objects/arrays.\n * - For objects: recursively removes properties whose pruned value is empty. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n * - For any other type: returns the value unchanged.\n *\n * @example\n * ```ts\n * prune(' hello '); // 'hello'\n * prune(' '); // undefined\n * prune([1, null, '', 2, undefined, 3]); // [1, 2, 3]\n * prune({ a: 1, b: null, c: '', d: 2 }); // { a: 1, d: 2 }\n * prune({ a: { b: null, c: '' }, d: 1 }); // { d: 1 }\n * ```\n *\n * @param value - The value to prune.\n * @returns The pruned value, or `undefined` if the result would be empty.\n */\nexport function prune(value: string): string | undefined;\nexport function prune<T>(value: T[]): Array<NonNullable<T>> | undefined;\nexport function prune<T extends Record<string, unknown>>(value: T): Partial<T> | undefined;\nexport function prune<T>(value: T): T | undefined;\nexport function prune<T>(value: T): T | undefined {\n if (value === null || value === undefined) return undefined;\n\n if (typeof value === 'string') {\n const trimmed = value.trim();\n\n return (trimmed === '' ? undefined : trimmed) as T | undefined;\n }\n\n if (Array.isArray(value)) {\n const cleaned = filterMap(value as unknown[], (item) => {\n const pruned = prune(item);\n\n return isEmpty(pruned) ? undefined : (pruned as unknown);\n });\n\n return (cleaned.length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n if (isPlainObject(value)) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(value)) {\n if (isUnsafeKey(key)) continue;\n\n const cleanedValue = prune(val);\n\n if (!isEmpty(cleanedValue)) {\n cleaned[key] = cleanedValue;\n }\n }\n\n return (Object.keys(cleaned).length === 0 ? undefined : cleaned) as T | undefined;\n }\n\n return value;\n}\n"],"mappings":"oNA8BA,SAAgB,MAAS,EAAyB,CAC5C,MAAU,KAEd,IAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAU,EAAM,KAAK,EAE3B,OAAQ,IAAY,GAAK,IAAA,GAAY,CACvC,CAEA,GAAI,MAAM,QAAQ,CAAK,EAAG,CACxB,IAAM,EAAU,EAAU,EAAqB,GAAS,CACtD,IAAM,EAAS,MAAM,CAAI,EAEzB,OAAO,EAAQ,CAAM,EAAI,IAAA,GAAa,CACxC,CAAC,EAED,OAAQ,EAAQ,SAAW,EAAI,IAAA,GAAY,CAC7C,CAEA,GAAI,EAAc,CAAK,EAAG,CACxB,IAAM,EAAmC,CAAC,EAE1C,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAK,EAAG,CAC9C,GAAI,EAAY,CAAG,EAAG,SAEtB,IAAM,EAAe,MAAM,CAAG,EAEzB,EAAQ,CAAY,IACvB,EAAQ,GAAO,EAEnB,CAEA,OAAQ,OAAO,KAAK,CAAO,CAAC,CAAC,SAAW,EAAI,IAAA,GAAY,CAC1D,CAEA,OAAO,CA5BP,CA6BF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function tryParseJson(e){try{return{ok:!0,value:JSON.parse(e)}}catch(e){return{error:e,ok:!1}}}exports.tryParseJson=tryParseJson;
|
|
2
2
|
//# sourceMappingURL=tryParseJson.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryParseJson.cjs","names":[],"sources":["../../src/object/tryParseJson.ts"],"sourcesContent":["export type JsonParseResult = { ok: true; value: unknown } | { error: SyntaxError; ok: false };\n\nexport function tryParseJson(text: string): JsonParseResult {\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch (error) {\n return { error: error as SyntaxError, ok: false };\n }\n}\n"],"mappings":"AAEA,SAAgB,
|
|
1
|
+
{"version":3,"file":"tryParseJson.cjs","names":[],"sources":["../../src/object/tryParseJson.ts"],"sourcesContent":["export type JsonParseResult = { ok: true; value: unknown } | { error: SyntaxError; ok: false };\n\nexport function tryParseJson(text: string): JsonParseResult {\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch (error) {\n return { error: error as SyntaxError, ok: false };\n }\n}\n"],"mappings":"AAEA,SAAgB,aAAa,EAA+B,CAC1D,GAAI,CACF,MAAO,CAAE,GAAI,GAAM,MAAO,KAAK,MAAM,CAAI,CAAa,CACxD,OAAS,EAAO,CACd,MAAO,CAAS,QAAsB,GAAI,EAAM,CAClD,CACF"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e) {
|
|
3
|
-
try {
|
|
4
|
-
return {
|
|
5
|
-
ok: !0,
|
|
6
|
-
value: JSON.parse(e)
|
|
7
|
-
};
|
|
8
|
-
} catch (e) {
|
|
9
|
-
return {
|
|
10
|
-
error: e,
|
|
11
|
-
ok: !1
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { e as tryParseJson };
|
|
17
|
-
|
|
1
|
+
function tryParseJson(e){try{return{ok:!0,value:JSON.parse(e)}}catch(e){return{error:e,ok:!1}}}export{tryParseJson};
|
|
18
2
|
//# sourceMappingURL=tryParseJson.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryParseJson.js","names":[],"sources":["../../src/object/tryParseJson.ts"],"sourcesContent":["export type JsonParseResult = { ok: true; value: unknown } | { error: SyntaxError; ok: false };\n\nexport function tryParseJson(text: string): JsonParseResult {\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch (error) {\n return { error: error as SyntaxError, ok: false };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tryParseJson.js","names":[],"sources":["../../src/object/tryParseJson.ts"],"sourcesContent":["export type JsonParseResult = { ok: true; value: unknown } | { error: SyntaxError; ok: false };\n\nexport function tryParseJson(text: string): JsonParseResult {\n try {\n return { ok: true, value: JSON.parse(text) as unknown };\n } catch (error) {\n return { error: error as SyntaxError, ok: false };\n }\n}\n"],"mappings":"AAEA,SAAgB,aAAa,EAA+B,CAC1D,GAAI,CACF,MAAO,CAAE,GAAI,GAAM,MAAO,KAAK,MAAM,CAAI,CAAa,CACxD,OAAS,EAAO,CACd,MAAO,CAAS,QAAsB,GAAI,EAAM,CAClD,CACF"}
|
package/dist/random/_index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./source.cjs");function
|
|
1
|
+
const e=require("./source.cjs");function randomIndex(t,n){return Math.floor(e.randomFloat(n)*t)}exports.randomIndex=randomIndex;
|
|
2
2
|
//# sourceMappingURL=_index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_index.cjs","names":[],"sources":["../../src/random/_index.ts"],"sourcesContent":["import { type RandomSource, randomFloat } from './source';\n\nexport function randomIndex(exclusiveMax: number, source?: RandomSource): number {\n return Math.floor(randomFloat(source) * exclusiveMax);\n}\n"],"mappings":"gCAEA,SAAgB,
|
|
1
|
+
{"version":3,"file":"_index.cjs","names":[],"sources":["../../src/random/_index.ts"],"sourcesContent":["import { type RandomSource, randomFloat } from './source';\n\nexport function randomIndex(exclusiveMax: number, source?: RandomSource): number {\n return Math.floor(randomFloat(source) * exclusiveMax);\n}\n"],"mappings":"gCAEA,SAAgB,YAAY,EAAsB,EAA+B,CAC/E,OAAO,KAAK,MAAM,EAAA,YAAY,CAAM,EAAI,CAAY,CACtD"}
|
package/dist/random/_index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/random/_index.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
return Math.floor(e(n) * t);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { t as randomIndex };
|
|
8
|
-
|
|
1
|
+
import{randomFloat as e}from"./source.js";function randomIndex(t,n){return Math.floor(e(n)*t)}export{randomIndex};
|
|
9
2
|
//# sourceMappingURL=_index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_index.js","names":[],"sources":["../../src/random/_index.ts"],"sourcesContent":["import { type RandomSource, randomFloat } from './source';\n\nexport function randomIndex(exclusiveMax: number, source?: RandomSource): number {\n return Math.floor(randomFloat(source) * exclusiveMax);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"_index.js","names":[],"sources":["../../src/random/_index.ts"],"sourcesContent":["import { type RandomSource, randomFloat } from './source';\n\nexport function randomIndex(exclusiveMax: number, source?: RandomSource): number {\n return Math.floor(randomFloat(source) * exclusiveMax);\n}\n"],"mappings":"0CAEA,SAAgB,YAAY,EAAsB,EAA+B,CAC/E,OAAO,KAAK,MAAM,EAAY,CAAM,EAAI,CAAY,CACtD"}
|
package/dist/random/draw.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./_index.cjs"),t=require("./random.cjs");function
|
|
1
|
+
const e=require("./_index.cjs"),t=require("./random.cjs");function draw(e,n){if(e.length!==0)return e[t.random(0,e.length-1,n)]}function drawMany(t,n,r){let i=Math.max(0,Math.min(t.length,Math.floor(n)));if(i===0)return[];if(i===t.length)return[...t];let a=[...t];for(let t=a.length-1;t>0;t--){let n=e.randomIndex(t+1,r),i=a[t];a[t]=a[n],a[n]=i}return a.slice(0,i)}exports.draw=draw,exports.drawMany=drawMany;
|
|
2
2
|
//# sourceMappingURL=draw.cjs.map
|
package/dist/random/draw.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.cjs","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"0DAcA,SAAgB,
|
|
1
|
+
{"version":3,"file":"draw.cjs","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"0DAcA,SAAgB,KAAQ,EAAY,EAAsC,CACpE,KAAM,SAAW,EAErB,OAAO,EAAM,EAAA,OAAO,EAAG,EAAM,OAAS,EAAG,CAAM,EACjD,CAaA,SAAgB,SAAY,EAAY,EAAW,EAA4B,CAC7E,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,IAAI,EAAM,OAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,EAE/D,GAAI,IAAU,EAAG,MAAO,CAAC,EAEzB,GAAI,IAAU,EAAM,OAAQ,MAAO,CAAC,GAAG,CAAK,EAE5C,IAAM,EAAO,CAAC,GAAG,CAAK,EAEtB,IAAK,IAAI,EAAQ,EAAK,OAAS,EAAG,EAAQ,EAAG,IAAS,CACpD,IAAM,EAAgB,EAAA,YAAY,EAAQ,EAAG,CAAM,EAC7C,EAAO,EAAK,GAElB,EAAK,GAAS,EAAK,GACnB,EAAK,GAAiB,CACxB,CAEA,OAAO,EAAK,MAAM,EAAG,CAAK,CAC5B"}
|
package/dist/random/draw.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { random as t } from "./random.js";
|
|
3
|
-
//#region src/random/draw.ts
|
|
4
|
-
function n(e, n) {
|
|
5
|
-
if (e.length !== 0) return e[t(0, e.length - 1, n)];
|
|
6
|
-
}
|
|
7
|
-
function r(t, n, r) {
|
|
8
|
-
let i = Math.max(0, Math.min(t.length, Math.floor(n)));
|
|
9
|
-
if (i === 0) return [];
|
|
10
|
-
if (i === t.length) return [...t];
|
|
11
|
-
let a = [...t];
|
|
12
|
-
for (let t = a.length - 1; t > 0; t--) {
|
|
13
|
-
let n = e(t + 1, r), i = a[t];
|
|
14
|
-
a[t] = a[n], a[n] = i;
|
|
15
|
-
}
|
|
16
|
-
return a.slice(0, i);
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { n as draw, r as drawMany };
|
|
20
|
-
|
|
1
|
+
import{randomIndex as e}from"./_index.js";import{random as t}from"./random.js";function draw(e,n){if(e.length!==0)return e[t(0,e.length-1,n)]}function drawMany(t,n,r){let i=Math.max(0,Math.min(t.length,Math.floor(n)));if(i===0)return[];if(i===t.length)return[...t];let a=[...t];for(let t=a.length-1;t>0;t--){let n=e(t+1,r),i=a[t];a[t]=a[n],a[n]=i}return a.slice(0,i)}export{draw,drawMany};
|
|
21
2
|
//# sourceMappingURL=draw.js.map
|
package/dist/random/draw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.js","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"draw.js","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"+EAcA,SAAgB,KAAQ,EAAY,EAAsC,CACpE,KAAM,SAAW,EAErB,OAAO,EAAM,EAAO,EAAG,EAAM,OAAS,EAAG,CAAM,EACjD,CAaA,SAAgB,SAAY,EAAY,EAAW,EAA4B,CAC7E,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,IAAI,EAAM,OAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,EAE/D,GAAI,IAAU,EAAG,MAAO,CAAC,EAEzB,GAAI,IAAU,EAAM,OAAQ,MAAO,CAAC,GAAG,CAAK,EAE5C,IAAM,EAAO,CAAC,GAAG,CAAK,EAEtB,IAAK,IAAI,EAAQ,EAAK,OAAS,EAAG,EAAQ,EAAG,IAAS,CACpD,IAAM,EAAgB,EAAY,EAAQ,EAAG,CAAM,EAC7C,EAAO,EAAK,GAElB,EAAK,GAAS,EAAK,GACnB,EAAK,GAAiB,CACxB,CAEA,OAAO,EAAK,MAAM,EAAG,CAAK,CAC5B"}
|
package/dist/random/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { random as t } from "./random.js";
|
|
3
|
-
import { draw as n, drawMany as r } from "./draw.js";
|
|
4
|
-
import { shuffle as i } from "./shuffle.js";
|
|
5
|
-
export { n as draw, r as drawMany, t as random, e as randomFloat, i as shuffle };
|
|
1
|
+
import{randomFloat as e}from"./source.js";import{random as t}from"./random.js";import{draw as n,drawMany as r}from"./draw.js";import{shuffle as i}from"./shuffle.js";export{n as draw,r as drawMany,t as random,e as randomFloat,i as shuffle};
|
package/dist/random/random.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./_index.cjs");function
|
|
1
|
+
const e=require("./_index.cjs");function random(t,n,r){if(t>n)throw RangeError(`random: minimum value must not be greater than maximum value`);return e.randomIndex(n-t+1,r)+t}exports.random=random;
|
|
2
2
|
//# sourceMappingURL=random.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.cjs","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"gCAeA,SAAgB,
|
|
1
|
+
{"version":3,"file":"random.cjs","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"gCAeA,SAAgB,OAAO,EAAa,EAAa,EAA+B,CAC9E,GAAI,EAAM,EAAK,MAAU,WAAW,8DAA8D,EAElG,OAAO,EAAA,YAAY,EAAM,EAAM,EAAG,CAAM,EAAI,CAC9C"}
|
package/dist/random/random.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/random/random.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
if (t > n) throw RangeError("random: minimum value must not be greater than maximum value");
|
|
5
|
-
return e(n - t + 1, r) + t;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { t as random };
|
|
9
|
-
|
|
1
|
+
import{randomIndex as e}from"./_index.js";function random(t,n,r){if(t>n)throw RangeError(`random: minimum value must not be greater than maximum value`);return e(n-t+1,r)+t}export{random};
|
|
10
2
|
//# sourceMappingURL=random.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.js","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"random.js","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"0CAeA,SAAgB,OAAO,EAAa,EAAa,EAA+B,CAC9E,GAAI,EAAM,EAAK,MAAU,WAAW,8DAA8D,EAElG,OAAO,EAAY,EAAM,EAAM,EAAG,CAAM,EAAI,CAC9C"}
|
package/dist/random/shuffle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./_index.cjs");function
|
|
1
|
+
const e=require("./_index.cjs");function shuffle(t,n){let r=[...t];for(let t=r.length-1;t>0;t--){let i=e.randomIndex(t+1,n);[r[t],r[i]]=[r[i],r[t]]}return r}exports.shuffle=shuffle;
|
|
2
2
|
//# sourceMappingURL=shuffle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.cjs","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"gCAaA,SAAgB,
|
|
1
|
+
{"version":3,"file":"shuffle.cjs","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"gCAaA,SAAgB,QAAW,EAAY,EAA4B,CACjE,IAAM,EAAS,CAAC,GAAG,CAAK,EAExB,IAAK,IAAI,EAAI,EAAO,OAAS,EAAG,EAAI,EAAG,IAAK,CAC1C,IAAM,EAAI,EAAA,YAAY,EAAI,EAAG,CAAM,EAEnC,CAAC,EAAO,GAAI,EAAO,IAAM,CAAC,EAAO,GAAI,EAAO,EAAE,CAChD,CAEA,OAAO,CACT"}
|
package/dist/random/shuffle.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/random/shuffle.ts
|
|
3
|
-
function t(t, n) {
|
|
4
|
-
let r = [...t];
|
|
5
|
-
for (let t = r.length - 1; t > 0; t--) {
|
|
6
|
-
let i = e(t + 1, n);
|
|
7
|
-
[r[t], r[i]] = [r[i], r[t]];
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as shuffle };
|
|
13
|
-
|
|
1
|
+
import{randomIndex as e}from"./_index.js";function shuffle(t,n){let r=[...t];for(let t=r.length-1;t>0;t--){let i=e(t+1,n);[r[t],r[i]]=[r[i],r[t]]}return r}export{shuffle};
|
|
14
2
|
//# sourceMappingURL=shuffle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.js","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shuffle.js","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"0CAaA,SAAgB,QAAW,EAAY,EAA4B,CACjE,IAAM,EAAS,CAAC,GAAG,CAAK,EAExB,IAAK,IAAI,EAAI,EAAO,OAAS,EAAG,EAAI,EAAG,IAAK,CAC1C,IAAM,EAAI,EAAY,EAAI,EAAG,CAAM,EAEnC,CAAC,EAAO,GAAI,EAAO,IAAM,CAAC,EAAO,GAAI,EAAO,EAAE,CAChD,CAEA,OAAO,CACT"}
|
package/dist/random/source.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function randomFloat(e){let t=e?.next()??crypto.getRandomValues(new Uint32Array(1))[0]/4294967296;if(!Number.isFinite(t)||t<0||t>=1)throw RangeError(`random source must return a finite number in [0, 1)`);return t}exports.randomFloat=randomFloat;
|
|
2
2
|
//# sourceMappingURL=source.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.cjs","names":[],"sources":["../../src/random/source.ts"],"sourcesContent":["export type RandomSource = {\n next(): number;\n};\n\n/** Returns a validated random float in `[0, 1)`. */\nexport function randomFloat(source?: RandomSource): number {\n const value = source?.next() ?? crypto.getRandomValues(new Uint32Array(1))[0]! / 0x100000000;\n\n if (!Number.isFinite(value) || value < 0 || value >= 1) {\n throw new RangeError('random source must return a finite number in [0, 1)');\n }\n\n return value;\n}\n"],"mappings":"AAKA,SAAgB,
|
|
1
|
+
{"version":3,"file":"source.cjs","names":[],"sources":["../../src/random/source.ts"],"sourcesContent":["export type RandomSource = {\n next(): number;\n};\n\n/** Returns a validated random float in `[0, 1)`. */\nexport function randomFloat(source?: RandomSource): number {\n const value = source?.next() ?? crypto.getRandomValues(new Uint32Array(1))[0]! / 0x100000000;\n\n if (!Number.isFinite(value) || value < 0 || value >= 1) {\n throw new RangeError('random source must return a finite number in [0, 1)');\n }\n\n return value;\n}\n"],"mappings":"AAKA,SAAgB,YAAY,EAA+B,CACzD,IAAM,EAAQ,GAAQ,KAAK,GAAK,OAAO,gBAAgB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,GAAM,WAEjF,GAAI,CAAC,OAAO,SAAS,CAAK,GAAK,EAAQ,GAAK,GAAS,EACnD,MAAU,WAAW,qDAAqD,EAG5E,OAAO,CACT"}
|
package/dist/random/source.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function e(e) {
|
|
3
|
-
let t = e?.next() ?? crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0] / 4294967296;
|
|
4
|
-
if (!Number.isFinite(t) || t < 0 || t >= 1) throw RangeError("random source must return a finite number in [0, 1)");
|
|
5
|
-
return t;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { e as randomFloat };
|
|
9
|
-
|
|
1
|
+
function randomFloat(e){let t=e?.next()??crypto.getRandomValues(new Uint32Array(1))[0]/4294967296;if(!Number.isFinite(t)||t<0||t>=1)throw RangeError(`random source must return a finite number in [0, 1)`);return t}export{randomFloat};
|
|
10
2
|
//# sourceMappingURL=source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","names":[],"sources":["../../src/random/source.ts"],"sourcesContent":["export type RandomSource = {\n next(): number;\n};\n\n/** Returns a validated random float in `[0, 1)`. */\nexport function randomFloat(source?: RandomSource): number {\n const value = source?.next() ?? crypto.getRandomValues(new Uint32Array(1))[0]! / 0x100000000;\n\n if (!Number.isFinite(value) || value < 0 || value >= 1) {\n throw new RangeError('random source must return a finite number in [0, 1)');\n }\n\n return value;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source.js","names":[],"sources":["../../src/random/source.ts"],"sourcesContent":["export type RandomSource = {\n next(): number;\n};\n\n/** Returns a validated random float in `[0, 1)`. */\nexport function randomFloat(source?: RandomSource): number {\n const value = source?.next() ?? crypto.getRandomValues(new Uint32Array(1))[0]! / 0x100000000;\n\n if (!Number.isFinite(value) || value < 0 || value >= 1) {\n throw new RangeError('random source must return a finite number in [0, 1)');\n }\n\n return value;\n}\n"],"mappings":"AAKA,SAAgB,YAAY,EAA+B,CACzD,IAAM,EAAQ,GAAQ,KAAK,GAAK,OAAO,gBAAgB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,GAAM,WAEjF,GAAI,CAAC,OAAO,SAAS,CAAK,GAAK,EAAQ,GAAK,GAAS,EACnD,MAAU,WAAW,qDAAqD,EAG5E,OAAO,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=/(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;function
|
|
1
|
+
var e=/(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;function escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\/-]/g,`\\$&`)}function normalizeCase(t,n=` `){let r=escapeRegex(n);return t.trim().replace(e,`$1$3$5${n}$2$4$6`).replace(/[^\p{L}\p{N}]+/gu,n).replace(RegExp(`^(?:${r})+|(?:${r})+$`,`g`),``)}exports.normalizeCase=normalizeCase;
|
|
2
2
|
//# sourceMappingURL=_caseUtils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_caseUtils.cjs","names":[],"sources":["../../src/string/_caseUtils.ts"],"sourcesContent":["/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n"],"mappings":"AAOA,IAAM,EAAqB,uEAG3B,SAAS,
|
|
1
|
+
{"version":3,"file":"_caseUtils.cjs","names":[],"sources":["../../src/string/_caseUtils.ts"],"sourcesContent":["/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n"],"mappings":"AAOA,IAAM,EAAqB,uEAG3B,SAAS,YAAY,EAAqB,CACxC,OAAO,EAAI,QAAQ,wBAAyB,MAAM,CACpD,CASA,SAAgB,cAAc,EAAa,EAAY,IAAa,CAClE,IAAM,EAAa,YAAY,CAAS,EAExC,OAAO,EACJ,KAAK,CAAC,CACN,QAAQ,EAAoB,SAAS,EAAU,OAAO,CAAC,CACvD,QAAQ,mBAAoB,CAAS,CAAC,CACtC,QAAY,OAAO,OAAO,EAAW,QAAQ,EAAW,KAAM,GAAG,EAAG,EAAE,CAC3E"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var e = /(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;
|
|
3
|
-
function t(e) {
|
|
4
|
-
return e.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&");
|
|
5
|
-
}
|
|
6
|
-
function n(n, r = " ") {
|
|
7
|
-
let i = t(r);
|
|
8
|
-
return n.trim().replace(e, `$1$3$5${r}$2$4$6`).replace(/[^\p{L}\p{N}]+/gu, r).replace(RegExp(`^(?:${i})+|(?:${i})+$`, "g"), "");
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { n as normalizeCase };
|
|
12
|
-
|
|
1
|
+
var e=/(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;function escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\/-]/g,`\\$&`)}function normalizeCase(t,n=` `){let r=escapeRegex(n);return t.trim().replace(e,`$1$3$5${n}$2$4$6`).replace(/[^\p{L}\p{N}]+/gu,n).replace(RegExp(`^(?:${r})+|(?:${r})+$`,`g`),``)}export{normalizeCase};
|
|
13
2
|
//# sourceMappingURL=_caseUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_caseUtils.js","names":[],"sources":["../../src/string/_caseUtils.ts"],"sourcesContent":["/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"_caseUtils.js","names":[],"sources":["../../src/string/_caseUtils.ts"],"sourcesContent":["/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n"],"mappings":"AAOA,IAAM,EAAqB,uEAG3B,SAAS,YAAY,EAAqB,CACxC,OAAO,EAAI,QAAQ,wBAAyB,MAAM,CACpD,CASA,SAAgB,cAAc,EAAa,EAAY,IAAa,CAClE,IAAM,EAAa,YAAY,CAAS,EAExC,OAAO,EACJ,KAAK,CAAC,CACN,QAAQ,EAAoB,SAAS,EAAU,OAAO,CAAC,CACvD,QAAQ,mBAAoB,CAAS,CAAC,CACtC,QAAY,OAAO,OAAO,EAAW,QAAQ,EAAW,KAAM,GAAG,EAAG,EAAE,CAC3E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./_caseUtils.cjs");function
|
|
1
|
+
const e=require("./_caseUtils.cjs");function camelCase(t){return e.normalizeCase(t,` `).replace(/[^\p{L}\p{N}]+(.)/gu,(e,t)=>t.toUpperCase()).replace(/^./,e=>e.toLowerCase())}exports.camelCase=camelCase;
|
|
2
2
|
//# sourceMappingURL=camelCase.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camelCase.cjs","names":[],"sources":["../../src/string/camelCase.ts"],"sourcesContent":["import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"oCAcA,SAAgB,
|
|
1
|
+
{"version":3,"file":"camelCase.cjs","names":[],"sources":["../../src/string/camelCase.ts"],"sourcesContent":["import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"oCAcA,SAAgB,UAAU,EAAqB,CAC7C,OAAO,EAAA,cAAc,EAAK,GAAG,CAAC,CAC3B,QAAQ,uBAAwB,EAAG,IAAS,EAAK,YAAY,CAAC,CAAC,CAC/D,QAAQ,KAAO,GAAS,EAAK,YAAY,CAAC,CAC/C"}
|
package/dist/string/camelCase.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/string/camelCase.ts
|
|
3
|
-
function t(t) {
|
|
4
|
-
return e(t, " ").replace(/[^\p{L}\p{N}]+(.)/gu, (e, t) => t.toUpperCase()).replace(/^./, (e) => e.toLowerCase());
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { t as camelCase };
|
|
8
|
-
|
|
1
|
+
import{normalizeCase as e}from"./_caseUtils.js";function camelCase(t){return e(t,` `).replace(/[^\p{L}\p{N}]+(.)/gu,(e,t)=>t.toUpperCase()).replace(/^./,e=>e.toLowerCase())}export{camelCase};
|
|
9
2
|
//# sourceMappingURL=camelCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camelCase.js","names":[],"sources":["../../src/string/camelCase.ts"],"sourcesContent":["import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"camelCase.js","names":[],"sources":["../../src/string/camelCase.ts"],"sourcesContent":["import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"gDAcA,SAAgB,UAAU,EAAqB,CAC7C,OAAO,EAAc,EAAK,GAAG,CAAC,CAC3B,QAAQ,uBAAwB,EAAG,IAAS,EAAK,YAAY,CAAC,CAAC,CAC/D,QAAQ,KAAO,GAAS,EAAK,YAAY,CAAC,CAC/C"}
|
package/dist/string/escape.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={"'":`'`,'"':`"`,"&":`&`,"<":`<`,">":`>`};function
|
|
1
|
+
var e={"'":`'`,'"':`"`,"&":`&`,"<":`<`,">":`>`};function escape(t){return t.replace(/[&<>"']/g,t=>e[t])}exports.escape=escape;
|
|
2
2
|
//# sourceMappingURL=escape.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.cjs","names":[],"sources":["../../src/string/escape.ts"],"sourcesContent":["const escapeMap: Record<string, string> = {\n \"'\": ''',\n '\"': '"',\n '&': '&',\n '<': '<',\n '>': '>',\n};\n\n/**\n * Escapes HTML entities.\n */\nexport function escape(value: string): string {\n return value.replace(/[&<>\"']/g, (char) => escapeMap[char]);\n}\n"],"mappings":"AAAA,IAAM,EAAoC,CACxC,IAAK,QACL,IAAK,SACL,IAAK,QACL,IAAK,OACL,IAAK,MACP,EAKA,SAAgB,
|
|
1
|
+
{"version":3,"file":"escape.cjs","names":[],"sources":["../../src/string/escape.ts"],"sourcesContent":["const escapeMap: Record<string, string> = {\n \"'\": ''',\n '\"': '"',\n '&': '&',\n '<': '<',\n '>': '>',\n};\n\n/**\n * Escapes HTML entities.\n */\nexport function escape(value: string): string {\n return value.replace(/[&<>\"']/g, (char) => escapeMap[char]);\n}\n"],"mappings":"AAAA,IAAM,EAAoC,CACxC,IAAK,QACL,IAAK,SACL,IAAK,QACL,IAAK,OACL,IAAK,MACP,EAKA,SAAgB,OAAO,EAAuB,CAC5C,OAAO,EAAM,QAAQ,WAAa,GAAS,EAAU,EAAK,CAC5D"}
|
package/dist/string/escape.js
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var e = {
|
|
3
|
-
"'": "'",
|
|
4
|
-
"\"": """,
|
|
5
|
-
"&": "&",
|
|
6
|
-
"<": "<",
|
|
7
|
-
">": ">"
|
|
8
|
-
};
|
|
9
|
-
function t(t) {
|
|
10
|
-
return t.replace(/[&<>"']/g, (t) => e[t]);
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { t as escape };
|
|
14
|
-
|
|
1
|
+
var e={"'":`'`,'"':`"`,"&":`&`,"<":`<`,">":`>`};function escape(t){return t.replace(/[&<>"']/g,t=>e[t])}export{escape};
|
|
15
2
|
//# sourceMappingURL=escape.js.map
|