@telperion/js-utils 3.7.1 → 3.8.1
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/.build-manifest.json +966 -0
- package/README.md +24 -0
- package/array/arrayize.cjs +5 -3
- package/array/arrayize.cjs.map +1 -0
- package/array/arrayize.d.cts +19 -0
- package/array/arrayize.d.ts +3 -1
- package/array/arrayize.js +2 -1
- package/array/arrayize.js.map +1 -1
- package/array/async-map.cjs +5 -3
- package/array/async-map.cjs.map +1 -0
- package/array/async-map.d.cts +36 -0
- package/array/async-map.d.ts +3 -1
- package/array/async-map.js +2 -1
- package/array/async-map.js.map +1 -1
- package/array/compact.cjs +8 -5
- package/array/compact.cjs.map +1 -0
- package/array/compact.d.cts +30 -0
- package/array/compact.d.ts +3 -1
- package/array/compact.js +4 -2
- package/array/compact.js.map +1 -1
- package/array/difference.cjs +5 -3
- package/array/difference.cjs.map +1 -0
- package/array/difference.d.cts +48 -0
- package/array/difference.d.ts +7 -4
- package/array/difference.js +2 -1
- package/array/difference.js.map +1 -1
- package/array/find-by-key.cjs +5 -3
- package/array/find-by-key.cjs.map +1 -0
- package/array/find-by-key.d.cts +32 -0
- package/array/find-by-key.d.ts +3 -1
- package/array/find-by-key.js +2 -1
- package/array/find-by-key.js.map +1 -1
- package/array/gather.cjs +5 -3
- package/array/gather.cjs.map +1 -0
- package/array/gather.d.cts +50 -0
- package/array/gather.d.ts +3 -1
- package/array/gather.js +2 -1
- package/array/gather.js.map +1 -1
- package/array/index.cjs +34 -15
- package/array/index.cjs.map +1 -0
- package/array/index.d.cts +14 -0
- package/array/index.d.ts +14 -12
- package/array/index.js +14 -13
- package/array/index.js.map +1 -1
- package/array/intersection.cjs +5 -3
- package/array/intersection.cjs.map +1 -0
- package/array/intersection.d.cts +48 -0
- package/array/intersection.d.ts +7 -4
- package/array/intersection.js +2 -1
- package/array/intersection.js.map +1 -1
- package/array/limit.cjs +5 -3
- package/array/limit.cjs.map +1 -0
- package/array/limit.d.cts +31 -0
- package/array/limit.d.ts +3 -1
- package/array/limit.js +2 -1
- package/array/limit.js.map +1 -1
- package/array/proto/async-map.cjs +6 -4
- package/array/proto/async-map.cjs.map +1 -0
- package/array/proto/async-map.d.cts +24 -0
- package/array/proto/async-map.d.ts +0 -1
- package/array/proto/async-map.js +2 -2
- package/array/proto/async-map.js.map +1 -1
- package/array/proto/compact.cjs +6 -4
- package/array/proto/compact.cjs.map +1 -0
- package/array/proto/compact.d.cts +14 -0
- package/array/proto/compact.d.ts +0 -1
- package/array/proto/compact.js +2 -2
- package/array/proto/compact.js.map +1 -1
- package/array/proto/difference.cjs +6 -4
- package/array/proto/difference.cjs.map +1 -0
- package/array/proto/difference.d.cts +28 -0
- package/array/proto/difference.d.ts +3 -2
- package/array/proto/difference.js +2 -2
- package/array/proto/difference.js.map +1 -1
- package/array/proto/find-by-key.cjs +6 -4
- package/array/proto/find-by-key.cjs.map +1 -0
- package/array/proto/find-by-key.d.cts +24 -0
- package/array/proto/find-by-key.d.ts +0 -1
- package/array/proto/find-by-key.js +2 -2
- package/array/proto/find-by-key.js.map +1 -1
- package/array/proto/gather.cjs +6 -4
- package/array/proto/gather.cjs.map +1 -0
- package/array/proto/gather.d.cts +31 -0
- package/array/proto/gather.d.ts +0 -1
- package/array/proto/gather.js +2 -2
- package/array/proto/gather.js.map +1 -1
- package/array/proto/intersection.cjs +6 -4
- package/array/proto/intersection.cjs.map +1 -0
- package/array/proto/intersection.d.cts +28 -0
- package/array/proto/intersection.d.ts +2 -1
- package/array/proto/intersection.js +2 -2
- package/array/proto/intersection.js.map +1 -1
- package/array/proto/limit.cjs +6 -4
- package/array/proto/limit.cjs.map +1 -0
- package/array/proto/limit.d.cts +23 -0
- package/array/proto/limit.d.ts +0 -1
- package/array/proto/limit.js +2 -2
- package/array/proto/limit.js.map +1 -1
- package/array/proto/remove.cjs +6 -4
- package/array/proto/remove.cjs.map +1 -0
- package/array/proto/remove.d.cts +32 -0
- package/array/proto/remove.d.ts +3 -3
- package/array/proto/remove.js +2 -2
- package/array/proto/remove.js.map +1 -1
- package/array/proto/replace.cjs +6 -4
- package/array/proto/replace.cjs.map +1 -0
- package/array/proto/replace.d.cts +73 -0
- package/array/proto/replace.d.ts +2 -1
- package/array/proto/replace.js +2 -2
- package/array/proto/replace.js.map +1 -1
- package/array/proto/slice-after.cjs +8 -0
- package/array/proto/slice-after.cjs.map +1 -0
- package/array/proto/slice-after.d.cts +33 -0
- package/array/proto/slice-after.d.ts +33 -0
- package/array/proto/slice-after.js +6 -0
- package/array/proto/slice-after.js.map +1 -0
- package/array/proto/slice-before.cjs +8 -0
- package/array/proto/slice-before.cjs.map +1 -0
- package/array/proto/slice-before.d.cts +33 -0
- package/array/proto/slice-before.d.ts +33 -0
- package/array/proto/slice-before.js +6 -0
- package/array/proto/slice-before.js.map +1 -0
- package/array/proto/uniquify-by-key.cjs +6 -4
- package/array/proto/uniquify-by-key.cjs.map +1 -0
- package/array/proto/uniquify-by-key.d.cts +23 -0
- package/array/proto/uniquify-by-key.d.ts +0 -1
- package/array/proto/uniquify-by-key.js +2 -2
- package/array/proto/uniquify-by-key.js.map +1 -1
- package/array/proto/uniquify.cjs +6 -4
- package/array/proto/uniquify.cjs.map +1 -0
- package/array/proto/uniquify.d.cts +22 -0
- package/array/proto/uniquify.d.ts +0 -1
- package/array/proto/uniquify.js +2 -2
- package/array/proto/uniquify.js.map +1 -1
- package/array/remove.cjs +5 -3
- package/array/remove.cjs.map +1 -0
- package/array/remove.d.cts +35 -0
- package/array/remove.d.ts +3 -1
- package/array/remove.js +2 -1
- package/array/remove.js.map +1 -1
- package/array/replace.cjs +5 -3
- package/array/replace.cjs.map +1 -0
- package/array/replace.d.cts +142 -0
- package/array/replace.d.ts +10 -7
- package/array/replace.js +2 -1
- package/array/replace.js.map +1 -1
- package/array/slice-after.cjs +44 -0
- package/array/slice-after.cjs.map +1 -0
- package/array/slice-after.d.cts +35 -0
- package/array/slice-after.d.ts +35 -0
- package/array/slice-after.js +42 -0
- package/array/slice-after.js.map +1 -0
- package/array/slice-before.cjs +44 -0
- package/array/slice-before.cjs.map +1 -0
- package/array/slice-before.d.cts +35 -0
- package/array/slice-before.d.ts +35 -0
- package/array/slice-before.js +42 -0
- package/array/slice-before.js.map +1 -0
- package/array/static/arrayize.cjs +6 -4
- package/array/static/arrayize.cjs.map +1 -0
- package/array/static/arrayize.d.cts +23 -0
- package/array/static/arrayize.d.ts +18 -1
- package/array/static/arrayize.js +2 -2
- package/array/static/arrayize.js.map +1 -1
- package/array/uniquify-by-key.cjs +5 -3
- package/array/uniquify-by-key.cjs.map +1 -0
- package/array/uniquify-by-key.d.cts +31 -0
- package/array/uniquify-by-key.d.ts +3 -1
- package/array/uniquify-by-key.js +2 -1
- package/array/uniquify-by-key.js.map +1 -1
- package/array/uniquify.cjs +5 -3
- package/array/uniquify.cjs.map +1 -0
- package/array/uniquify.d.cts +29 -0
- package/array/uniquify.d.ts +3 -1
- package/array/uniquify.js +2 -1
- package/array/uniquify.js.map +1 -1
- package/boolean/static/is-falsy.cjs +6 -4
- package/boolean/static/is-falsy.cjs.map +1 -0
- package/boolean/static/is-falsy.d.cts +24 -0
- package/boolean/static/is-falsy.d.ts +2 -1
- package/boolean/static/is-falsy.js +2 -2
- package/boolean/static/is-falsy.js.map +1 -1
- package/boolean/static/is-truthy.cjs +6 -4
- package/boolean/static/is-truthy.cjs.map +1 -0
- package/boolean/static/is-truthy.d.cts +24 -0
- package/boolean/static/is-truthy.d.ts +2 -1
- package/boolean/static/is-truthy.js +2 -2
- package/boolean/static/is-truthy.js.map +1 -1
- package/class/index.cjs +8 -4
- package/class/index.cjs.map +1 -0
- package/class/index.d.cts +1 -0
- package/class/index.d.ts +1 -1
- package/class/index.js +1 -2
- package/class/index.js.map +1 -1
- package/class/mixin.cjs +5 -3
- package/class/mixin.cjs.map +1 -0
- package/class/mixin.d.cts +51 -0
- package/class/mixin.d.ts +3 -2
- package/class/mixin.js +2 -1
- package/class/mixin.js.map +1 -1
- package/compact.cjs +10 -7
- package/compact.cjs.map +1 -0
- package/compact.d.cts +4 -0
- package/compact.d.ts +4 -2
- package/compact.js +7 -5
- package/compact.js.map +1 -1
- package/fesm/js-utils.mjs +1856 -0
- package/fesm/js-utils.mjs.map +1 -0
- package/function/call.cjs +25 -3
- package/function/call.cjs.map +1 -0
- package/function/call.d.cts +23 -0
- package/function/call.d.ts +23 -1
- package/function/call.js +22 -1
- package/function/call.js.map +1 -1
- package/function/debounce.cjs +20 -17
- package/function/debounce.cjs.map +1 -0
- package/function/debounce.d.cts +47 -0
- package/function/debounce.d.ts +8 -5
- package/function/debounce.js +9 -7
- package/function/debounce.js.map +1 -1
- package/function/defer.cjs +8 -5
- package/function/defer.cjs.map +1 -0
- package/function/defer.d.cts +28 -0
- package/function/defer.d.ts +3 -1
- package/function/defer.js +4 -2
- package/function/defer.js.map +1 -1
- package/function/index.cjs +18 -8
- package/function/index.cjs.map +1 -0
- package/function/index.d.cts +5 -0
- package/function/index.d.ts +5 -5
- package/function/index.js +5 -6
- package/function/index.js.map +1 -1
- package/function/noop.cjs +5 -3
- package/function/noop.cjs.map +1 -0
- package/function/noop.d.cts +22 -0
- package/function/noop.d.ts +3 -1
- package/function/noop.js +2 -1
- package/function/noop.js.map +1 -1
- package/function/of.cjs +8 -5
- package/function/of.cjs.map +1 -0
- package/function/of.d.cts +33 -0
- package/function/of.d.ts +3 -1
- package/function/of.js +4 -2
- package/function/of.js.map +1 -1
- package/function/proto/debounce.cjs +7 -5
- package/function/proto/debounce.cjs.map +1 -0
- package/function/proto/debounce.d.cts +29 -0
- package/function/proto/debounce.d.ts +0 -1
- package/function/proto/debounce.js +2 -2
- package/function/proto/debounce.js.map +1 -1
- package/function/static/call.cjs +6 -4
- package/function/static/call.cjs.map +1 -0
- package/function/static/call.d.cts +23 -0
- package/function/static/call.d.ts +18 -1
- package/function/static/call.js +2 -2
- package/function/static/call.js.map +1 -1
- package/function/static/defer.cjs +6 -4
- package/function/static/defer.cjs.map +1 -0
- package/function/static/defer.d.cts +24 -0
- package/function/static/defer.d.ts +2 -1
- package/function/static/defer.js +2 -2
- package/function/static/defer.js.map +1 -1
- package/function/static/noop.cjs +6 -4
- package/function/static/noop.cjs.map +1 -0
- package/function/static/noop.d.cts +19 -0
- package/function/static/noop.d.ts +2 -1
- package/function/static/noop.js +2 -2
- package/function/static/noop.js.map +1 -1
- package/function/static/of.cjs +6 -4
- package/function/static/of.cjs.map +1 -0
- package/function/static/of.d.cts +27 -0
- package/function/static/of.d.ts +2 -1
- package/function/static/of.js +2 -2
- package/function/static/of.js.map +1 -1
- package/index.cjs +95 -34
- package/index.cjs.map +1 -0
- package/index.d.cts +44 -0
- package/index.d.ts +44 -15
- package/index.js +43 -17
- package/index.js.map +1 -1
- package/is-falsy.cjs +6 -4
- package/is-falsy.cjs.map +1 -0
- package/is-falsy.d.cts +30 -0
- package/is-falsy.d.ts +4 -2
- package/is-falsy.js +3 -2
- package/is-falsy.js.map +1 -1
- package/is-truthy.cjs +6 -4
- package/is-truthy.cjs.map +1 -0
- package/is-truthy.d.cts +30 -0
- package/is-truthy.d.ts +4 -2
- package/is-truthy.js +3 -2
- package/is-truthy.js.map +1 -1
- package/limit.cjs +10 -7
- package/limit.cjs.map +1 -0
- package/limit.d.cts +4 -0
- package/limit.d.ts +4 -2
- package/limit.js +7 -5
- package/limit.js.map +1 -1
- package/map/index.cjs +8 -4
- package/map/index.cjs.map +1 -0
- package/map/index.d.cts +1 -0
- package/map/index.d.ts +1 -1
- package/map/index.js +1 -2
- package/map/index.js.map +1 -1
- package/map/merge.cjs +5 -3
- package/map/merge.cjs.map +1 -0
- package/map/merge.d.cts +26 -0
- package/map/merge.d.ts +3 -1
- package/map/merge.js +2 -1
- package/map/merge.js.map +1 -1
- package/math/index.cjs +8 -4
- package/math/index.cjs.map +1 -0
- package/math/index.d.cts +1 -0
- package/math/index.d.ts +1 -1
- package/math/index.js +1 -2
- package/math/index.js.map +1 -1
- package/math/min-max.cjs +5 -3
- package/math/min-max.cjs.map +1 -0
- package/math/min-max.d.cts +26 -0
- package/math/min-max.d.ts +3 -1
- package/math/min-max.js +2 -1
- package/math/min-max.js.map +1 -1
- package/math/static/min-max.cjs +6 -4
- package/math/static/min-max.cjs.map +1 -0
- package/math/static/min-max.d.cts +21 -0
- package/math/static/min-max.d.ts +2 -1
- package/math/static/min-max.js +2 -2
- package/math/static/min-max.js.map +1 -1
- package/object/clone.cjs +14 -11
- package/object/clone.cjs.map +1 -0
- package/object/clone.d.cts +164 -0
- package/object/clone.d.ts +9 -6
- package/object/clone.js +6 -4
- package/object/clone.js.map +1 -1
- package/object/compact.cjs +5 -3
- package/object/compact.cjs.map +1 -0
- package/object/compact.d.cts +39 -0
- package/object/compact.d.ts +3 -1
- package/object/compact.js +2 -1
- package/object/compact.js.map +1 -1
- package/object/deep-freeze.cjs +24 -3
- package/object/deep-freeze.cjs.map +1 -0
- package/object/deep-freeze.d.cts +22 -0
- package/object/deep-freeze.d.ts +22 -1
- package/object/deep-freeze.js +21 -1
- package/object/deep-freeze.js.map +1 -1
- package/object/deepest.cjs +5 -3
- package/object/deepest.cjs.map +1 -0
- package/object/deepest.d.cts +50 -0
- package/object/deepest.d.ts +5 -2
- package/object/deepest.js +2 -1
- package/object/deepest.js.map +1 -1
- package/object/index.cjs +16 -8
- package/object/index.cjs.map +1 -0
- package/object/index.d.cts +6 -0
- package/object/index.d.ts +6 -5
- package/object/index.js +5 -6
- package/object/index.js.map +1 -1
- package/object/map.cjs +5 -3
- package/object/map.cjs.map +1 -0
- package/object/map.d.cts +34 -0
- package/object/map.d.ts +3 -1
- package/object/map.js +2 -1
- package/object/map.js.map +1 -1
- package/object/static/clone.cjs +6 -4
- package/object/static/clone.cjs.map +1 -0
- package/object/static/clone.d.cts +44 -0
- package/object/static/clone.d.ts +3 -2
- package/object/static/clone.js +2 -2
- package/object/static/clone.js.map +1 -1
- package/object/static/compact.cjs +6 -4
- package/object/static/compact.cjs.map +1 -0
- package/object/static/compact.d.cts +27 -0
- package/object/static/compact.d.ts +2 -1
- package/object/static/compact.js +2 -2
- package/object/static/compact.js.map +1 -1
- package/object/static/deep-freeze.cjs +6 -4
- package/object/static/deep-freeze.cjs.map +1 -0
- package/object/static/deep-freeze.d.cts +23 -0
- package/object/static/deep-freeze.d.ts +18 -1
- package/object/static/deep-freeze.js +2 -2
- package/object/static/deep-freeze.js.map +1 -1
- package/object/static/deepest.cjs +6 -4
- package/object/static/deepest.cjs.map +1 -0
- package/object/static/deepest.d.cts +34 -0
- package/object/static/deepest.d.ts +3 -1
- package/object/static/deepest.js +2 -2
- package/object/static/deepest.js.map +1 -1
- package/object/static/map.cjs +6 -4
- package/object/static/map.cjs.map +1 -0
- package/object/static/map.d.cts +27 -0
- package/object/static/map.d.ts +2 -1
- package/object/static/map.js +2 -2
- package/object/static/map.js.map +1 -1
- package/open-promise.cjs +13 -11
- package/open-promise.cjs.map +1 -0
- package/open-promise.d.cts +82 -0
- package/open-promise.d.ts +5 -3
- package/open-promise.js +4 -2
- package/open-promise.js.map +1 -1
- package/package.json +820 -412
- package/promise/chain.cjs +5 -3
- package/promise/chain.cjs.map +1 -0
- package/promise/chain.d.cts +9 -0
- package/promise/chain.d.ts +3 -1
- package/promise/chain.js +2 -1
- package/promise/chain.js.map +1 -1
- package/promise/index.cjs +21 -10
- package/promise/index.cjs.map +1 -0
- package/promise/index.d.cts +7 -0
- package/promise/index.d.ts +7 -7
- package/promise/index.js +7 -8
- package/promise/index.js.map +1 -1
- package/promise/never.cjs +10 -7
- package/promise/never.cjs.map +1 -0
- package/promise/never.d.cts +36 -0
- package/promise/never.d.ts +4 -2
- package/promise/never.js +5 -3
- package/promise/never.js.map +1 -1
- package/promise/promisify.cjs +5 -3
- package/promise/promisify.cjs.map +1 -0
- package/promise/promisify.d.cts +9 -0
- package/promise/promisify.d.ts +3 -1
- package/promise/promisify.js +2 -1
- package/promise/promisify.js.map +1 -1
- package/promise/proto/revert.cjs +6 -4
- package/promise/proto/revert.cjs.map +1 -0
- package/promise/proto/revert.d.cts +28 -0
- package/promise/proto/revert.d.ts +1 -2
- package/promise/proto/revert.js +2 -2
- package/promise/proto/revert.js.map +1 -1
- package/promise/proto/try-catch.cjs +6 -4
- package/promise/proto/try-catch.cjs.map +1 -0
- package/promise/proto/try-catch.d.cts +29 -0
- package/promise/proto/try-catch.d.ts +1 -2
- package/promise/proto/try-catch.js +2 -2
- package/promise/proto/try-catch.js.map +1 -1
- package/promise/revert.cjs +5 -3
- package/promise/revert.cjs.map +1 -0
- package/promise/revert.d.cts +40 -0
- package/promise/revert.d.ts +3 -1
- package/promise/revert.js +2 -1
- package/promise/revert.js.map +1 -1
- package/promise/static/chain.cjs +6 -4
- package/promise/static/chain.cjs.map +1 -0
- package/promise/static/chain.d.cts +11 -0
- package/promise/static/chain.d.ts +2 -1
- package/promise/static/chain.js +2 -2
- package/promise/static/chain.js.map +1 -1
- package/promise/static/never.cjs +7 -5
- package/promise/static/never.cjs.map +1 -0
- package/promise/static/never.d.cts +40 -0
- package/promise/static/never.d.ts +2 -1
- package/promise/static/never.js +2 -2
- package/promise/static/never.js.map +1 -1
- package/promise/static/timeout.cjs +6 -4
- package/promise/static/timeout.cjs.map +1 -0
- package/promise/static/timeout.d.cts +22 -0
- package/promise/static/timeout.d.ts +2 -1
- package/promise/static/timeout.js +2 -2
- package/promise/static/timeout.js.map +1 -1
- package/promise/static/try-one-by-one.cjs +6 -4
- package/promise/static/try-one-by-one.cjs.map +1 -0
- package/promise/static/try-one-by-one.d.cts +28 -0
- package/promise/static/try-one-by-one.d.ts +2 -1
- package/promise/static/try-one-by-one.js +2 -2
- package/promise/static/try-one-by-one.js.map +1 -1
- package/promise/timeout.cjs +13 -11
- package/promise/timeout.cjs.map +1 -0
- package/promise/timeout.d.cts +112 -0
- package/promise/timeout.d.ts +5 -2
- package/promise/timeout.js +4 -3
- package/promise/timeout.js.map +1 -1
- package/promise/try-catch.cjs +5 -3
- package/promise/try-catch.cjs.map +1 -0
- package/promise/try-catch.d.cts +47 -0
- package/promise/try-catch.d.ts +4 -2
- package/promise/try-catch.js +2 -1
- package/promise/try-catch.js.map +1 -1
- package/promise/try-one-by-one.cjs +5 -3
- package/promise/try-one-by-one.cjs.map +1 -0
- package/promise/try-one-by-one.d.cts +44 -0
- package/promise/try-one-by-one.d.ts +3 -1
- package/promise/try-one-by-one.js +2 -1
- package/promise/try-one-by-one.js.map +1 -1
- package/set/proto/difference.cjs +6 -4
- package/set/proto/difference.cjs.map +1 -0
- package/set/proto/difference.d.cts +27 -0
- package/set/proto/difference.d.ts +2 -1
- package/set/proto/difference.js +2 -2
- package/set/proto/difference.js.map +1 -1
- package/set/proto/intersection.cjs +6 -4
- package/set/proto/intersection.cjs.map +1 -0
- package/set/proto/intersection.d.cts +27 -0
- package/set/proto/intersection.d.ts +2 -1
- package/set/proto/intersection.js +2 -2
- package/set/proto/intersection.js.map +1 -1
- package/smart-map.cjs +4 -3
- package/smart-map.cjs.map +1 -0
- package/smart-map.d.cts +82 -0
- package/smart-map.d.ts +3 -2
- package/smart-map.js +2 -1
- package/smart-map.js.map +1 -1
- package/string/index.cjs +8 -4
- package/string/index.cjs.map +1 -0
- package/string/index.d.cts +1 -0
- package/string/index.d.ts +1 -1
- package/string/index.js +1 -2
- package/string/index.js.map +1 -1
- package/string/limit.cjs +8 -5
- package/string/limit.cjs.map +1 -0
- package/string/limit.d.cts +31 -0
- package/string/limit.d.ts +3 -1
- package/string/limit.js +5 -3
- package/string/limit.js.map +1 -1
- package/string/proto/limit.cjs +6 -4
- package/string/proto/limit.cjs.map +1 -0
- package/string/proto/limit.d.cts +30 -0
- package/string/proto/limit.d.ts +3 -3
- package/string/proto/limit.js +2 -2
- package/string/proto/limit.js.map +1 -1
- package/time/days.cjs +8 -5
- package/time/days.cjs.map +1 -0
- package/time/days.d.cts +17 -0
- package/time/days.d.ts +3 -1
- package/time/days.js +4 -2
- package/time/days.js.map +1 -1
- package/time/hours.cjs +8 -5
- package/time/hours.cjs.map +1 -0
- package/time/hours.d.cts +17 -0
- package/time/hours.d.ts +3 -1
- package/time/hours.js +4 -2
- package/time/hours.js.map +1 -1
- package/time/index.cjs +20 -10
- package/time/index.cjs.map +1 -0
- package/time/index.d.cts +7 -0
- package/time/index.d.ts +7 -7
- package/time/index.js +7 -8
- package/time/index.js.map +1 -1
- package/time/minutes.cjs +8 -5
- package/time/minutes.cjs.map +1 -0
- package/time/minutes.d.cts +17 -0
- package/time/minutes.d.ts +3 -1
- package/time/minutes.js +4 -2
- package/time/minutes.js.map +1 -1
- package/time/months.cjs +8 -5
- package/time/months.cjs.map +1 -0
- package/time/months.d.cts +17 -0
- package/time/months.d.ts +3 -1
- package/time/months.js +4 -2
- package/time/months.js.map +1 -1
- package/time/seconds.cjs +5 -3
- package/time/seconds.cjs.map +1 -0
- package/time/seconds.d.cts +17 -0
- package/time/seconds.d.ts +3 -1
- package/time/seconds.js +2 -1
- package/time/seconds.js.map +1 -1
- package/time/weeks.cjs +8 -5
- package/time/weeks.cjs.map +1 -0
- package/time/weeks.d.cts +17 -0
- package/time/weeks.d.ts +3 -1
- package/time/weeks.js +4 -2
- package/time/weeks.js.map +1 -1
- package/time/years.cjs +8 -5
- package/time/years.cjs.map +1 -0
- package/time/years.d.cts +17 -0
- package/time/years.d.ts +3 -1
- package/time/years.js +4 -2
- package/time/years.js.map +1 -1
- package/unique-id.cjs +5 -3
- package/unique-id.cjs.map +1 -0
- package/unique-id.d.cts +23 -0
- package/unique-id.d.ts +4 -2
- package/unique-id.js +2 -1
- package/unique-id.js.map +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export interface Array<T> {
|
|
3
|
+
/**
|
|
4
|
+
* #### Uniquify By Key
|
|
5
|
+
*
|
|
6
|
+
* Removes objects from the array which the value of its specifed key included before by another
|
|
7
|
+
*
|
|
8
|
+
* * * *
|
|
9
|
+
* Example:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import "@telperion/js-utils/array/proto/uniquify-by-key";
|
|
12
|
+
*
|
|
13
|
+
* const array = [{a: 1}, {a: 1}, {a: 2}, {a: 3}, {a: 3}, {a: 4}];
|
|
14
|
+
*
|
|
15
|
+
* array.uniquifyByKey('a'); // [{a: 1}, {a: 2}, {a: 3}, {a: 4}]
|
|
16
|
+
* ```
|
|
17
|
+
* * * *
|
|
18
|
+
* @param key Key to search the value on
|
|
19
|
+
* @return The new uniquified array
|
|
20
|
+
*/
|
|
21
|
+
uniquifyByKey(key: keyof T): T[];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { uniquifyByKey } from '
|
|
1
|
+
import { uniquifyByKey } from '../uniquify-by-key.js';
|
|
2
|
+
|
|
2
3
|
Array.prototype.uniquifyByKey = function (key) {
|
|
3
4
|
return uniquifyByKey(this, key);
|
|
4
5
|
};
|
|
5
|
-
|
|
6
6
|
//# sourceMappingURL=uniquify-by-key.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/js-utils/src/array/proto/uniquify-by-key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uniquify-by-key.js","sources":["../../../../../libs/js-utils/src/array/proto/uniquify-by-key.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA0BA,KAAK,CAAC,SAAS,CAAC,aAAa,GAAG,UAAsC,GAAY,EAAA;AAChF,IAAA,OAAO,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC;AACjC,CAAC"}
|
package/array/proto/uniquify.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var array_uniquify = require('../uniquify.cjs');
|
|
4
|
+
|
|
4
5
|
Array.prototype.uniquify = function () {
|
|
5
|
-
return
|
|
6
|
+
return array_uniquify.uniquify(this);
|
|
6
7
|
};
|
|
8
|
+
//# sourceMappingURL=uniquify.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniquify.cjs","sources":["../../../../../libs/js-utils/src/array/proto/uniquify.ts"],"sourcesContent":[null],"names":["uniquify"],"mappings":";;;;AAyBA,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAQ,YAAA;AAC9B,IAAA,OAAOA,uBAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export interface Array<T> {
|
|
3
|
+
/**
|
|
4
|
+
* #### Uniquify
|
|
5
|
+
*
|
|
6
|
+
* Removes repeated items from the array
|
|
7
|
+
*
|
|
8
|
+
* * * *
|
|
9
|
+
* Example:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import "@telperion/js-utils/array/proto/uniquify";
|
|
12
|
+
*
|
|
13
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
14
|
+
*
|
|
15
|
+
* array.uniquify(); // ["a", "b", "c"]
|
|
16
|
+
* ```
|
|
17
|
+
* * * *
|
|
18
|
+
* @return The new uniquified array
|
|
19
|
+
*/
|
|
20
|
+
uniquify(): T[];
|
|
21
|
+
}
|
|
22
|
+
}
|
package/array/proto/uniquify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/js-utils/src/array/proto/uniquify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uniquify.js","sources":["../../../../../libs/js-utils/src/array/proto/uniquify.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAyBA,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAQ,YAAA;AAC9B,IAAA,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC"}
|
package/array/remove.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.remove = remove;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
4
3
|
/**
|
|
5
4
|
* #### Remove
|
|
6
5
|
*
|
|
@@ -44,3 +43,6 @@ function remove(array, item, multi = false) {
|
|
|
44
43
|
} while (multi && index > -1);
|
|
45
44
|
return array;
|
|
46
45
|
}
|
|
46
|
+
|
|
47
|
+
exports.remove = remove;
|
|
48
|
+
//# sourceMappingURL=remove.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.cjs","sources":["../../../../libs/js-utils/src/array/remove.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,MAAM,CAAc,KAAU,EAAE,IAAO,EAAE,KAAK,GAAG,KAAK,EAAA;IACpE,IAAI,KAAK,GAAW,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAEvC,IAAA,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,CAAC,GAAG,KAAK,CAAC;IACnB;AAEA,IAAA,GAAG;QACD,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC7D,QAAA,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAC7B,IAAA,CAAC,QAAQ,KAAK,IAAI,KAAK,GAAG,EAAE;AAE5B,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Remove
|
|
3
|
+
*
|
|
4
|
+
* Removes an item from the array
|
|
5
|
+
*
|
|
6
|
+
* Removes all item references if multi is set to `true`
|
|
7
|
+
*
|
|
8
|
+
* * * *
|
|
9
|
+
* Example:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { remove } from "@telperion/js-utils/array";
|
|
12
|
+
*
|
|
13
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
14
|
+
*
|
|
15
|
+
* remove(array, "b"); // ["a", "c", "a", "b", "c"]
|
|
16
|
+
* remove(array, "b", true); // ["a", "c", "a", "c"]
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Prototype Example:
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import "@telperion/js-utils/array/proto/remove";
|
|
22
|
+
*
|
|
23
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
24
|
+
*
|
|
25
|
+
* array.remove("b"); // ["a", "c", "a", "b", "c"]
|
|
26
|
+
* array.remove("b", true); // ["a", "c", "a", "c"]
|
|
27
|
+
* ```
|
|
28
|
+
* * * *
|
|
29
|
+
* @param array: Array to remove the item
|
|
30
|
+
* @param itemToRemove Item to remove
|
|
31
|
+
* @return New array
|
|
32
|
+
*/
|
|
33
|
+
declare function remove<T = unknown>(array: T[], item: T, multi?: boolean): T[];
|
|
34
|
+
|
|
35
|
+
export { remove };
|
package/array/remove.d.ts
CHANGED
|
@@ -30,4 +30,6 @@
|
|
|
30
30
|
* @param itemToRemove Item to remove
|
|
31
31
|
* @return New array
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
declare function remove<T = unknown>(array: T[], item: T, multi?: boolean): T[];
|
|
34
|
+
|
|
35
|
+
export { remove };
|
package/array/remove.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* @param itemToRemove Item to remove
|
|
31
31
|
* @return New array
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
function remove(array, item, multi = false) {
|
|
34
34
|
let index = array.indexOf(item);
|
|
35
35
|
if (index < 0) {
|
|
36
36
|
return [...array];
|
|
@@ -42,4 +42,5 @@ export function remove(array, item, multi = false) {
|
|
|
42
42
|
return array;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export { remove };
|
|
45
46
|
//# sourceMappingURL=remove.js.map
|
package/array/remove.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"file":"remove.js","sources":["../../../../libs/js-utils/src/array/remove.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,MAAM,CAAc,KAAU,EAAE,IAAO,EAAE,KAAK,GAAG,KAAK,EAAA;IACpE,IAAI,KAAK,GAAW,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAEvC,IAAA,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,CAAC,GAAG,KAAK,CAAC;IACnB;AAEA,IAAA,GAAG;QACD,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC7D,QAAA,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAC7B,IAAA,CAAC,QAAQ,KAAK,IAAI,KAAK,GAAG,EAAE;AAE5B,IAAA,OAAO,KAAK;AACd;;;;"}
|
package/array/replace.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.replace = replace;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
4
3
|
/**
|
|
5
4
|
* Default Options for Replace Items Mode
|
|
6
5
|
*/
|
|
@@ -67,3 +66,6 @@ function _replaceByMap(array, options) {
|
|
|
67
66
|
});
|
|
68
67
|
return newArray;
|
|
69
68
|
}
|
|
69
|
+
|
|
70
|
+
exports.replace = replace;
|
|
71
|
+
//# sourceMappingURL=replace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.cjs","sources":["../../../../libs/js-utils/src/array/replace.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA+CA;;AAEG;AACH,MAAM,6BAA6B,GAAuC;AACxE,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,aAAa,EAAE;CAChB;AACD;;AAEG;AACH,MAAM,8BAA8B,GAAuC;IACzE,cAAc,EAAE,IAAI,GAAG,EAAE;AACzB,IAAA,KAAK,EAAE;CACR;SAmGe,OAAO,CACrB,KAAU,EACV,OAA4D,EAC5D,aAAiB,EAAA;AAEjB,IAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,QAAA,OAAO,GAA2B;AAChC,YAAA,aAAa,EAAE,KAAK,CAAC,OAAO,CAAI,OAAO,CAAC;YACxC,cAAc,EAAE,CAAC,aAAa;SAC/B;IACH;AAEA,IAAA,IAAsD,OAAQ,CAAC,cAAc,YAAY,KAAK,EAAE;AAC9F,QAAA,OAAO,aAAa,CAAC,KAAK,EAA0B,OAAO,CAAC;IAC9D;SAAO;AACL,QAAA,OAAO,aAAa,CAAC,KAAK,EAA0B,OAAO,CAAC;IAC9D;AACF;AAEA;;;;;AAKG;AACH,SAAS,aAAa,CAAI,KAAU,EAAE,OAA+B,EAAA;AACnE,IAAA,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,GAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,6BAA6B,EAAE,OAAO,CAAC;AAClJ,IAAA,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;;AAG3B,IAAA,IAAI,aAAa,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,QAAQ;IACjB;IAEA,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC;AAE9D,IAAA,OAAO,QAAQ;AACjB;AAEA;;;;;AAKG;AACH,SAAS,aAAa,CAAI,KAAU,EAAE,OAA+B,EAAA;AACnE,IAAA,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,8BAA8B,EAAE,OAAO,CAAC;AAC9H,IAAA,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI;AAC9E,IAAA,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;IAE3B,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;QACpC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAI;AAC7C,YAAA,MAAM,OAAO,GAAG,IAAI,KAAK,GAAG;YAE5B,IAAI,OAAO,EAAE;gBACX,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC;YAClC;AAEA,YAAA,OAAO,OAAO;AAChB,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,QAAQ;AACjB;;;;"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace Items Options Interface
|
|
3
|
+
*
|
|
4
|
+
* @template T typeof the items of the array
|
|
5
|
+
*/
|
|
6
|
+
interface ReplaceItemsOptions<T> {
|
|
7
|
+
/**
|
|
8
|
+
* Starting index of the array for replacement operation
|
|
9
|
+
*
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
startingIndex?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Determines how many items will be deleted from the array
|
|
15
|
+
*
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
deleteCount?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Items to replace
|
|
21
|
+
*
|
|
22
|
+
* @default []
|
|
23
|
+
*/
|
|
24
|
+
itemsToReplace?: T[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Replace by Item Matcher Map Options Interface
|
|
28
|
+
*
|
|
29
|
+
* @template T typeof the items of the array
|
|
30
|
+
*/
|
|
31
|
+
interface ReplaceByMapOptions<T> {
|
|
32
|
+
/**
|
|
33
|
+
* Items' Matcher Map to replace
|
|
34
|
+
*/
|
|
35
|
+
itemsToReplace: Map<T, T>;
|
|
36
|
+
/**
|
|
37
|
+
* Set as `true` to replace all items in the array if matches with the key of the matcher map while iterating
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
multi?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* #### Replace
|
|
45
|
+
*
|
|
46
|
+
* Replaces an item with passed one of an array
|
|
47
|
+
*
|
|
48
|
+
* * * *
|
|
49
|
+
* Example:
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { replace } from "@telperion/js-utils/array";
|
|
52
|
+
*
|
|
53
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
54
|
+
*
|
|
55
|
+
* replace(array, "b", "x"); // ["a", "x", "c", "a", "b", "c"]
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Array Prototype Example:
|
|
59
|
+
* ```typescript
|
|
60
|
+
* import "@telperion/js-utils/array/proto/replace";
|
|
61
|
+
*
|
|
62
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
63
|
+
*
|
|
64
|
+
* array.replace("b", "x"); // ["a", "x", "c", "a", "b", "c"]
|
|
65
|
+
* ```
|
|
66
|
+
* * * *
|
|
67
|
+
* @param array Array to replace its item
|
|
68
|
+
* @param itemToRemove Item to remove
|
|
69
|
+
* @param itemToReplace Item to replace with
|
|
70
|
+
* @template T Typeof array items
|
|
71
|
+
* @return New replaced array
|
|
72
|
+
*/
|
|
73
|
+
declare function replace<T>(array: T[], itemToRemove: T, itemToReplace: T): T[];
|
|
74
|
+
/**
|
|
75
|
+
* #### Replace
|
|
76
|
+
*
|
|
77
|
+
* Deletes items and replaces new ones from passed starting index of an array
|
|
78
|
+
*
|
|
79
|
+
* * * *
|
|
80
|
+
* Example:
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { replace } from "@telperion/js-utils";
|
|
83
|
+
*
|
|
84
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
85
|
+
*
|
|
86
|
+
* replace(array, {startingIndex: 3, deleteCount: 1, itemsToReplace: ['x', 'y']}); // ["a", "b", "c", "x", "y", "b", "c"];
|
|
87
|
+
* ```
|
|
88
|
+
* Array Prototype Example:
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import "@telperion/js-utils/array/proto/replace";
|
|
91
|
+
*
|
|
92
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
93
|
+
*
|
|
94
|
+
* array.replace({startingIndex: 3, deleteCount: 1, itemsToReplace: ['x', 'y']}); // ["a", "b", "c", "x", "y", "b", "c"];
|
|
95
|
+
* ```
|
|
96
|
+
* * * *
|
|
97
|
+
* @param array Array to replace its item
|
|
98
|
+
* @param replaceOptions Replace options
|
|
99
|
+
* @template T Typeof array items
|
|
100
|
+
* @return New replaced array
|
|
101
|
+
*/
|
|
102
|
+
declare function replace<T>(array: T[], replaceOptions: ReplaceItemsOptions<T>): T[];
|
|
103
|
+
/**
|
|
104
|
+
* #### Replace
|
|
105
|
+
*
|
|
106
|
+
* Deletes items and replaces new ones by passed matcher map
|
|
107
|
+
*
|
|
108
|
+
* * * *
|
|
109
|
+
* Example:
|
|
110
|
+
* ```typescript
|
|
111
|
+
* import { replace } from "@telperion/js-utils";
|
|
112
|
+
*
|
|
113
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
114
|
+
* const map = new Map();
|
|
115
|
+
* map.set("a", "x")
|
|
116
|
+
* map.set("b", "y");
|
|
117
|
+
*
|
|
118
|
+
* replace(array, {itemsToReplace: map}); // ["x", "y", "c", "a", "b", "c"];
|
|
119
|
+
* replace(array, {itemsToReplace: map, multi: true}); // ["x", "y", "c", "x", "y", "c"];
|
|
120
|
+
* ```
|
|
121
|
+
* Array Prototype Example:
|
|
122
|
+
* ```typescript
|
|
123
|
+
* import "@telperion/js-utils/array/proto/replace";
|
|
124
|
+
*
|
|
125
|
+
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
126
|
+
* const map = new Map();
|
|
127
|
+
* map.set("a", "x")
|
|
128
|
+
* map.set("b", "y");
|
|
129
|
+
*
|
|
130
|
+
* array.replace({itemsToReplace: map}); // ["x", "y", "c", "a", "b", "c"];
|
|
131
|
+
* array.replace({itemsToReplace: map, multi: true}); // ["x", "y", "c", "x", "y", "c"];
|
|
132
|
+
* ```
|
|
133
|
+
* * * *
|
|
134
|
+
* @param array Array to replace its item
|
|
135
|
+
* @param replaceOptions Replace options
|
|
136
|
+
* @template T Typeof array items
|
|
137
|
+
* @return New replaced array
|
|
138
|
+
*/
|
|
139
|
+
declare function replace<T>(array: T[], replaceOptions: ReplaceByMapOptions<T>): T[];
|
|
140
|
+
|
|
141
|
+
export { replace };
|
|
142
|
+
export type { ReplaceByMapOptions, ReplaceItemsOptions };
|
package/array/replace.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @template T typeof the items of the array
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
interface ReplaceItemsOptions<T> {
|
|
7
7
|
/**
|
|
8
8
|
* Starting index of the array for replacement operation
|
|
9
9
|
*
|
|
@@ -28,7 +28,7 @@ export interface ReplaceItemsOptions<T> {
|
|
|
28
28
|
*
|
|
29
29
|
* @template T typeof the items of the array
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
interface ReplaceByMapOptions<T> {
|
|
32
32
|
/**
|
|
33
33
|
* Items' Matcher Map to replace
|
|
34
34
|
*/
|
|
@@ -70,7 +70,7 @@ export interface ReplaceByMapOptions<T> {
|
|
|
70
70
|
* @template T Typeof array items
|
|
71
71
|
* @return New replaced array
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
declare function replace<T>(array: T[], itemToRemove: T, itemToReplace: T): T[];
|
|
74
74
|
/**
|
|
75
75
|
* #### Replace
|
|
76
76
|
*
|
|
@@ -87,7 +87,7 @@ export declare function replace<T>(array: T[], itemToRemove: T, itemToReplace: T
|
|
|
87
87
|
* ```
|
|
88
88
|
* Array Prototype Example:
|
|
89
89
|
* ```typescript
|
|
90
|
-
* import "@telperion/js-utils/
|
|
90
|
+
* import "@telperion/js-utils/array/proto/replace";
|
|
91
91
|
*
|
|
92
92
|
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
93
93
|
*
|
|
@@ -99,7 +99,7 @@ export declare function replace<T>(array: T[], itemToRemove: T, itemToReplace: T
|
|
|
99
99
|
* @template T Typeof array items
|
|
100
100
|
* @return New replaced array
|
|
101
101
|
*/
|
|
102
|
-
|
|
102
|
+
declare function replace<T>(array: T[], replaceOptions: ReplaceItemsOptions<T>): T[];
|
|
103
103
|
/**
|
|
104
104
|
* #### Replace
|
|
105
105
|
*
|
|
@@ -120,7 +120,7 @@ export declare function replace<T>(array: T[], replaceOptions: ReplaceItemsOptio
|
|
|
120
120
|
* ```
|
|
121
121
|
* Array Prototype Example:
|
|
122
122
|
* ```typescript
|
|
123
|
-
* import "@telperion/js-utils/
|
|
123
|
+
* import "@telperion/js-utils/array/proto/replace";
|
|
124
124
|
*
|
|
125
125
|
* const array = ["a", "b", "c", "a", "b", "c"];
|
|
126
126
|
* const map = new Map();
|
|
@@ -136,4 +136,7 @@ export declare function replace<T>(array: T[], replaceOptions: ReplaceItemsOptio
|
|
|
136
136
|
* @template T Typeof array items
|
|
137
137
|
* @return New replaced array
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
declare function replace<T>(array: T[], replaceOptions: ReplaceByMapOptions<T>): T[];
|
|
140
|
+
|
|
141
|
+
export { replace };
|
|
142
|
+
export type { ReplaceByMapOptions, ReplaceItemsOptions };
|
package/array/replace.js
CHANGED
|
@@ -13,7 +13,7 @@ const REPLACE_BY_MAP_DEFAULT_OPTIONS = {
|
|
|
13
13
|
itemsToReplace: new Map(),
|
|
14
14
|
multi: false
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
function replace(array, options, itemToReplace) {
|
|
17
17
|
if (arguments.length > 2) {
|
|
18
18
|
options = {
|
|
19
19
|
startingIndex: array.indexOf(options),
|
|
@@ -65,4 +65,5 @@ function _replaceByMap(array, options) {
|
|
|
65
65
|
return newArray;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
export { replace };
|
|
68
69
|
//# sourceMappingURL=replace.js.map
|
package/array/replace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"file":"replace.js","sources":["../../../../libs/js-utils/src/array/replace.ts"],"sourcesContent":[null],"names":[],"mappings":"AA+CA;;AAEG;AACH,MAAM,6BAA6B,GAAuC;AACxE,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,aAAa,EAAE;CAChB;AACD;;AAEG;AACH,MAAM,8BAA8B,GAAuC;IACzE,cAAc,EAAE,IAAI,GAAG,EAAE;AACzB,IAAA,KAAK,EAAE;CACR;SAmGe,OAAO,CACrB,KAAU,EACV,OAA4D,EAC5D,aAAiB,EAAA;AAEjB,IAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AACxB,QAAA,OAAO,GAA2B;AAChC,YAAA,aAAa,EAAE,KAAK,CAAC,OAAO,CAAI,OAAO,CAAC;YACxC,cAAc,EAAE,CAAC,aAAa;SAC/B;IACH;AAEA,IAAA,IAAsD,OAAQ,CAAC,cAAc,YAAY,KAAK,EAAE;AAC9F,QAAA,OAAO,aAAa,CAAC,KAAK,EAA0B,OAAO,CAAC;IAC9D;SAAO;AACL,QAAA,OAAO,aAAa,CAAC,KAAK,EAA0B,OAAO,CAAC;IAC9D;AACF;AAEA;;;;;AAKG;AACH,SAAS,aAAa,CAAI,KAAU,EAAE,OAA+B,EAAA;AACnE,IAAA,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,GAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,6BAA6B,EAAE,OAAO,CAAC;AAClJ,IAAA,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;;AAG3B,IAAA,IAAI,aAAa,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,QAAQ;IACjB;IAEA,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC;AAE9D,IAAA,OAAO,QAAQ;AACjB;AAEA;;;;;AAKG;AACH,SAAS,aAAa,CAAI,KAAU,EAAE,OAA+B,EAAA;AACnE,IAAA,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,8BAA8B,EAAE,OAAO,CAAC;AAC9H,IAAA,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI;AAC9E,IAAA,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;IAE3B,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;QACpC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAI;AAC7C,YAAA,MAAM,OAAO,GAAG,IAAI,KAAK,GAAG;YAE5B,IAAI,OAAO,EAAE;gBACX,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC;YAClC;AAEA,YAAA,OAAO,OAAO;AAChB,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,QAAQ;AACjB;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* #### Slice After
|
|
5
|
+
*
|
|
6
|
+
* Returns a new array containing the items located after the first occurrence
|
|
7
|
+
* of the given item.
|
|
8
|
+
*
|
|
9
|
+
* If the item is not found, an empty array is returned.
|
|
10
|
+
*
|
|
11
|
+
* * * *
|
|
12
|
+
* Example:
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { sliceAfter } from "@telperion/js-utils/array";
|
|
15
|
+
*
|
|
16
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
17
|
+
*
|
|
18
|
+
* sliceAfter(fruits, "banana"); // ["melon", "orange"]
|
|
19
|
+
* sliceAfter(fruits, "kiwi"); // []
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Prototype Example:
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import "@telperion/js-utils/array/proto/slice-after";
|
|
25
|
+
*
|
|
26
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
27
|
+
*
|
|
28
|
+
* fruits.sliceAfter("banana"); // ["melon", "orange"]
|
|
29
|
+
* ```
|
|
30
|
+
* * * *
|
|
31
|
+
* @param array Array to slice
|
|
32
|
+
* @param item Item to slice after
|
|
33
|
+
* @return New array containing the items after the given item
|
|
34
|
+
*/
|
|
35
|
+
function sliceAfter(array, item) {
|
|
36
|
+
const index = array.indexOf(item);
|
|
37
|
+
if (index < 0) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return array.slice(index + 1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.sliceAfter = sliceAfter;
|
|
44
|
+
//# sourceMappingURL=slice-after.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-after.cjs","sources":["../../../../libs/js-utils/src/array/slice-after.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,UAAU,CAAc,KAAU,EAAE,IAAO,EAAA;IACzD,MAAM,KAAK,GAAW,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAEzC,IAAA,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,EAAE;IACX;IAEA,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;AAC/B;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Slice After
|
|
3
|
+
*
|
|
4
|
+
* Returns a new array containing the items located after the first occurrence
|
|
5
|
+
* of the given item.
|
|
6
|
+
*
|
|
7
|
+
* If the item is not found, an empty array is returned.
|
|
8
|
+
*
|
|
9
|
+
* * * *
|
|
10
|
+
* Example:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { sliceAfter } from "@telperion/js-utils/array";
|
|
13
|
+
*
|
|
14
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
15
|
+
*
|
|
16
|
+
* sliceAfter(fruits, "banana"); // ["melon", "orange"]
|
|
17
|
+
* sliceAfter(fruits, "kiwi"); // []
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Prototype Example:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import "@telperion/js-utils/array/proto/slice-after";
|
|
23
|
+
*
|
|
24
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
25
|
+
*
|
|
26
|
+
* fruits.sliceAfter("banana"); // ["melon", "orange"]
|
|
27
|
+
* ```
|
|
28
|
+
* * * *
|
|
29
|
+
* @param array Array to slice
|
|
30
|
+
* @param item Item to slice after
|
|
31
|
+
* @return New array containing the items after the given item
|
|
32
|
+
*/
|
|
33
|
+
declare function sliceAfter<T = unknown>(array: T[], item: T): T[];
|
|
34
|
+
|
|
35
|
+
export { sliceAfter };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Slice After
|
|
3
|
+
*
|
|
4
|
+
* Returns a new array containing the items located after the first occurrence
|
|
5
|
+
* of the given item.
|
|
6
|
+
*
|
|
7
|
+
* If the item is not found, an empty array is returned.
|
|
8
|
+
*
|
|
9
|
+
* * * *
|
|
10
|
+
* Example:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { sliceAfter } from "@telperion/js-utils/array";
|
|
13
|
+
*
|
|
14
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
15
|
+
*
|
|
16
|
+
* sliceAfter(fruits, "banana"); // ["melon", "orange"]
|
|
17
|
+
* sliceAfter(fruits, "kiwi"); // []
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Prototype Example:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import "@telperion/js-utils/array/proto/slice-after";
|
|
23
|
+
*
|
|
24
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
25
|
+
*
|
|
26
|
+
* fruits.sliceAfter("banana"); // ["melon", "orange"]
|
|
27
|
+
* ```
|
|
28
|
+
* * * *
|
|
29
|
+
* @param array Array to slice
|
|
30
|
+
* @param item Item to slice after
|
|
31
|
+
* @return New array containing the items after the given item
|
|
32
|
+
*/
|
|
33
|
+
declare function sliceAfter<T = unknown>(array: T[], item: T): T[];
|
|
34
|
+
|
|
35
|
+
export { sliceAfter };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Slice After
|
|
3
|
+
*
|
|
4
|
+
* Returns a new array containing the items located after the first occurrence
|
|
5
|
+
* of the given item.
|
|
6
|
+
*
|
|
7
|
+
* If the item is not found, an empty array is returned.
|
|
8
|
+
*
|
|
9
|
+
* * * *
|
|
10
|
+
* Example:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { sliceAfter } from "@telperion/js-utils/array";
|
|
13
|
+
*
|
|
14
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
15
|
+
*
|
|
16
|
+
* sliceAfter(fruits, "banana"); // ["melon", "orange"]
|
|
17
|
+
* sliceAfter(fruits, "kiwi"); // []
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Prototype Example:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import "@telperion/js-utils/array/proto/slice-after";
|
|
23
|
+
*
|
|
24
|
+
* const fruits = ["apple", "grapes", "banana", "melon", "orange"];
|
|
25
|
+
*
|
|
26
|
+
* fruits.sliceAfter("banana"); // ["melon", "orange"]
|
|
27
|
+
* ```
|
|
28
|
+
* * * *
|
|
29
|
+
* @param array Array to slice
|
|
30
|
+
* @param item Item to slice after
|
|
31
|
+
* @return New array containing the items after the given item
|
|
32
|
+
*/
|
|
33
|
+
function sliceAfter(array, item) {
|
|
34
|
+
const index = array.indexOf(item);
|
|
35
|
+
if (index < 0) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
return array.slice(index + 1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { sliceAfter };
|
|
42
|
+
//# sourceMappingURL=slice-after.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-after.js","sources":["../../../../libs/js-utils/src/array/slice-after.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,UAAU,CAAc,KAAU,EAAE,IAAO,EAAA;IACzD,MAAM,KAAK,GAAW,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;AAEzC,IAAA,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,EAAE;IACX;IAEA,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;AAC/B;;;;"}
|