ts-data-forge 9.0.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/array/impl/array-utils-creation.d.mts +4 -4
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-creation.mjs +17 -112
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +22 -61
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-iterators.d.mts.map +1 -1
- package/dist/array/impl/array-utils-iterators.mjs +9 -63
- package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.d.mts +7 -7
- package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs +78 -78
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +95 -89
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.mjs +100 -92
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +31 -141
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts.map +1 -1
- package/dist/array/impl/array-utils-size.mjs +4 -8
- package/dist/array/impl/array-utils-size.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs +11 -12
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +44 -96
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts +4 -4
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +150 -292
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.d.mts +17 -17
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +23 -174
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/array/impl/index.mjs +1 -1
- package/dist/collections/imap-mapped.d.mts.map +1 -1
- package/dist/collections/imap-mapped.mjs +243 -330
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +190 -275
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +1 -1
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs +222 -444
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +1 -1
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +158 -324
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.d.mts.map +1 -1
- package/dist/collections/queue.mjs +106 -178
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.d.mts.map +1 -1
- package/dist/collections/stack.mjs +95 -165
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +2 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/expect-type.d.mts +1 -1
- package/dist/expect-type.d.mts.map +1 -1
- package/dist/expect-type.mjs +1 -69
- package/dist/expect-type.mjs.map +1 -1
- package/dist/functional/match.mjs +9 -9
- package/dist/functional/match.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-expect-to-be.mjs +13 -14
- package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-filter.mjs +14 -15
- package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.mjs +10 -11
- package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-from-nullable.mjs +1 -25
- package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-none.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-none.mjs +0 -19
- package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +1 -23
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-some.mjs +0 -20
- package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-map.mjs +13 -14
- package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-none.mjs +0 -16
- package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-or-else.mjs +10 -11
- package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs +2 -21
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-to-nullable.mjs +1 -27
- package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-or.mjs +9 -10
- package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs +4 -32
- package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-unwrap.mjs +4 -4
- package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +1 -35
- package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
- package/dist/functional/optional/impl/tag.mjs +2 -3
- package/dist/functional/optional/impl/tag.mjs.map +1 -1
- package/dist/functional/pipe.d.mts.map +1 -1
- package/dist/functional/pipe.mjs +9 -34
- package/dist/functional/pipe.mjs.map +1 -1
- package/dist/functional/result/impl/result-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-err.mjs +2 -27
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-expect-to-be.mjs +13 -15
- package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
- package/dist/functional/result/impl/result-flat-map.mjs +16 -16
- package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-fold.mjs +16 -16
- package/dist/functional/result/impl/result-fold.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-promise.mjs +4 -31
- package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
- package/dist/functional/result/impl/result-from-throwable.mjs +8 -38
- package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-err.mjs +0 -19
- package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-ok.mjs +0 -19
- package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +1 -23
- package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
- package/dist/functional/result/impl/result-map-err.mjs +16 -16
- package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-map.mjs +16 -16
- package/dist/functional/result/impl/result-map.mjs.map +1 -1
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs +2 -27
- package/dist/functional/result/impl/result-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-or-else.mjs +10 -12
- package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
- package/dist/functional/result/impl/result-swap.d.mts.map +1 -1
- package/dist/functional/result/impl/result-swap.mjs +4 -22
- package/dist/functional/result/impl/result-swap.mjs.map +1 -1
- package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -1
- package/dist/functional/result/impl/result-to-optional.mjs +0 -27
- package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-or.mjs +9 -11
- package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +13 -40
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err.mjs +4 -32
- package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs +9 -11
- package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-ok.mjs +4 -4
- package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +4 -35
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-zip.d.mts.map +1 -1
- package/dist/functional/result/impl/result-zip.mjs +1 -34
- package/dist/functional/result/impl/result-zip.mjs.map +1 -1
- package/dist/functional/result/impl/tag.mjs +2 -3
- package/dist/functional/result/impl/tag.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/tag.mjs +3 -5
- package/dist/functional/ternary-result/impl/tag.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs +2 -15
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +13 -13
- package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +27 -26
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +21 -22
- package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +4 -20
- package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +7 -25
- package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +0 -17
- package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +0 -19
- package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +1 -25
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +0 -18
- package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +13 -15
- package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +18 -18
- package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs +21 -22
- package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +2 -16
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +9 -9
- package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +4 -22
- package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +9 -9
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +12 -27
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +4 -19
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +9 -9
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +4 -5
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +15 -27
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +9 -9
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +10 -24
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +4 -19
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +3 -19
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +14 -45
- package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/variant-name.d.mts +1 -1
- package/dist/functional/ternary-result/impl/variant-name.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/variant-name.mjs +8 -9
- package/dist/functional/ternary-result/impl/variant-name.mjs.map +1 -1
- package/dist/guard/as-length-bounded-array.d.mts +117 -0
- package/dist/guard/as-length-bounded-array.d.mts.map +1 -0
- package/dist/guard/as-length-bounded-array.mjs +37 -0
- package/dist/guard/as-length-bounded-array.mjs.map +1 -0
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +0 -41
- package/dist/guard/has-key.mjs.map +1 -1
- package/dist/guard/index.d.mts +2 -0
- package/dist/guard/index.d.mts.map +1 -1
- package/dist/guard/index.mjs +2 -0
- package/dist/guard/index.mjs.map +1 -1
- package/dist/guard/is-length-bounded-array.d.mts +159 -0
- package/dist/guard/is-length-bounded-array.d.mts.map +1 -0
- package/dist/guard/is-length-bounded-array.mjs +7 -0
- package/dist/guard/is-length-bounded-array.mjs.map +1 -0
- package/dist/guard/is-length-bounded-string.d.mts +5 -6
- package/dist/guard/is-length-bounded-string.d.mts.map +1 -1
- package/dist/guard/is-length-bounded-string.mjs +0 -157
- package/dist/guard/is-length-bounded-string.mjs.map +1 -1
- package/dist/guard/is-non-empty-string.d.mts +1 -1
- package/dist/guard/is-non-empty-string.d.mts.map +1 -1
- package/dist/guard/is-non-empty-string.mjs +1 -38
- package/dist/guard/is-non-empty-string.mjs.map +1 -1
- package/dist/guard/is-non-null-object.d.mts.map +1 -1
- package/dist/guard/is-non-null-object.mjs +1 -35
- package/dist/guard/is-non-null-object.mjs.map +1 -1
- package/dist/guard/is-primitive.d.mts.map +1 -1
- package/dist/guard/is-primitive.mjs +12 -43
- package/dist/guard/is-primitive.mjs.map +1 -1
- package/dist/guard/is-record.d.mts.map +1 -1
- package/dist/guard/is-record.mjs +0 -86
- package/dist/guard/is-record.mjs.map +1 -1
- package/dist/guard/is-type.d.mts.map +1 -1
- package/dist/guard/is-type.mjs +12 -399
- package/dist/guard/is-type.mjs.map +1 -1
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +0 -40
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/iterator/range.mjs +16 -16
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +52 -340
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.d.mts +3 -3
- package/dist/number/branded-types/finite-number.mjs +135 -154
- package/dist/number/branded-types/finite-number.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +4 -4
- package/dist/number/branded-types/int.mjs +205 -245
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/int16.d.mts +15 -15
- package/dist/number/branded-types/int16.mjs +116 -123
- package/dist/number/branded-types/int16.mjs.map +1 -1
- package/dist/number/branded-types/int32.d.mts +11 -11
- package/dist/number/branded-types/int32.mjs +116 -123
- package/dist/number/branded-types/int32.mjs.map +1 -1
- package/dist/number/branded-types/negative-finite-number.d.mts +4 -4
- package/dist/number/branded-types/negative-finite-number.mjs +129 -144
- package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/negative-int.d.mts +5 -5
- package/dist/number/branded-types/negative-int.mjs +94 -113
- package/dist/number/branded-types/negative-int.mjs.map +1 -1
- package/dist/number/branded-types/negative-safe-int.d.mts +5 -5
- package/dist/number/branded-types/negative-safe-int.mjs +103 -124
- package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.d.mts +5 -5
- package/dist/number/branded-types/non-negative-finite-number.mjs +136 -142
- package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int16.d.mts +16 -16
- package/dist/number/branded-types/non-negative-int16.mjs +109 -118
- package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int32.d.mts +12 -12
- package/dist/number/branded-types/non-negative-int32.mjs +110 -119
- package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.d.mts +3 -3
- package/dist/number/branded-types/non-positive-finite-number.mjs +120 -124
- package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-int.d.mts +4 -4
- package/dist/number/branded-types/non-positive-int.mjs +167 -212
- package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.d.mts +4 -4
- package/dist/number/branded-types/non-positive-safe-int.mjs +95 -106
- package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.d.mts +4 -4
- package/dist/number/branded-types/non-zero-finite-number.mjs +114 -123
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.d.mts +2 -2
- package/dist/number/branded-types/non-zero-int.mjs +72 -83
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.d.mts +7 -7
- package/dist/number/branded-types/non-zero-int16.mjs +96 -107
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.d.mts +5 -5
- package/dist/number/branded-types/non-zero-int32.mjs +97 -108
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.d.mts +2 -2
- package/dist/number/branded-types/non-zero-safe-int.mjs +100 -111
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.d.mts +8 -8
- package/dist/number/branded-types/non-zero-uint16.mjs +96 -107
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.d.mts +6 -6
- package/dist/number/branded-types/non-zero-uint32.mjs +96 -107
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.d.mts +8 -8
- package/dist/number/branded-types/positive-finite-number.mjs +139 -141
- package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/positive-int.d.mts +11 -11
- package/dist/number/branded-types/positive-int.mjs +228 -271
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-int16.d.mts +19 -19
- package/dist/number/branded-types/positive-int16.mjs +109 -118
- package/dist/number/branded-types/positive-int16.mjs.map +1 -1
- package/dist/number/branded-types/positive-int32.d.mts +15 -15
- package/dist/number/branded-types/positive-int32.mjs +109 -118
- package/dist/number/branded-types/positive-int32.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +11 -11
- package/dist/number/branded-types/positive-safe-int.mjs +244 -275
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint16.d.mts +17 -17
- package/dist/number/branded-types/positive-uint16.mjs +109 -118
- package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint32.d.mts +13 -13
- package/dist/number/branded-types/positive-uint32.mjs +110 -119
- package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +4 -4
- package/dist/number/branded-types/safe-int.mjs +251 -292
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.d.mts +8 -8
- package/dist/number/branded-types/safe-uint.mjs +111 -119
- package/dist/number/branded-types/safe-uint.mjs.map +1 -1
- package/dist/number/branded-types/uint.d.mts +8 -8
- package/dist/number/branded-types/uint.mjs +198 -225
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/branded-types/uint16.d.mts +14 -14
- package/dist/number/branded-types/uint16.mjs +109 -119
- package/dist/number/branded-types/uint16.mjs.map +1 -1
- package/dist/number/branded-types/uint32.d.mts +10 -10
- package/dist/number/branded-types/uint32.mjs +110 -117
- package/dist/number/branded-types/uint32.mjs.map +1 -1
- package/dist/number/enum/int8.mjs +119 -145
- package/dist/number/enum/int8.mjs.map +1 -1
- package/dist/number/enum/uint8.mjs +107 -121
- package/dist/number/enum/uint8.mjs.map +1 -1
- package/dist/number/num.d.mts +2 -2
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +76 -537
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.d.mts +1 -1
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs +127 -263
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +107 -222
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/cast-mutable.d.mts.map +1 -1
- package/dist/others/cast-mutable.mjs +8 -37
- package/dist/others/cast-mutable.mjs.map +1 -1
- package/dist/others/cast-readonly.d.mts.map +1 -1
- package/dist/others/cast-readonly.mjs +8 -36
- package/dist/others/cast-readonly.mjs.map +1 -1
- package/dist/others/debounce-function.d.mts.map +1 -1
- package/dist/others/debounce-function.mjs +7 -16
- package/dist/others/debounce-function.mjs.map +1 -1
- package/dist/others/fast-deep-equal.d.mts.map +1 -1
- package/dist/others/fast-deep-equal.mjs +43 -59
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/dist/others/if-then.d.mts.map +1 -1
- package/dist/others/if-then.mjs +0 -29
- package/dist/others/if-then.mjs.map +1 -1
- package/dist/others/map-nullable.mjs +9 -9
- package/dist/others/map-nullable.mjs.map +1 -1
- package/dist/others/memoize-function.mjs +12 -12
- package/dist/others/memoize-function.mjs.map +1 -1
- package/dist/others/tuple.d.mts.map +1 -1
- package/dist/others/tuple.mjs +0 -50
- package/dist/others/tuple.mjs.map +1 -1
- package/dist/others/unknown-to-string.d.mts.map +1 -1
- package/dist/others/unknown-to-string.mjs +41 -88
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/dist/promise/promise.d.mts.map +1 -1
- package/dist/promise/promise.mjs +4 -49
- package/dist/promise/promise.mjs.map +1 -1
- package/package.json +14 -13
- package/src/array/impl/array-utils-creation.mts +3 -3
- package/src/array/impl/array-utils-modification.mts +7 -7
- package/src/array/impl/array-utils-modification.test.mts +4 -4
- package/src/array/impl/array-utils-transformation.mts +4 -4
- package/src/array/impl/array-utils-transformation.test.mts +7 -7
- package/src/array/impl/array-utils-validation.mts +24 -24
- package/src/array/impl/array-utils-validation.test.mts +94 -92
- package/src/collections/queue.test.mts +1 -1
- package/src/guard/as-length-bounded-array.mts +190 -0
- package/src/guard/as-length-bounded-array.test.mts +118 -0
- package/src/guard/index.mts +2 -0
- package/src/guard/is-length-bounded-array.mts +195 -0
- package/src/guard/is-length-bounded-array.test.mts +169 -0
- package/src/guard/is-length-bounded-string.mts +6 -6
- package/src/object/object.test.mts +3 -3
|
@@ -38,115 +38,63 @@ import { size } from './array-utils-size.mjs';
|
|
|
38
38
|
import { sliceClamped } from './array-utils-slice-clamped.mjs';
|
|
39
39
|
import { isEmpty } from './array-utils-validation.mjs';
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
* const remainder = Arr.tail(scientists);
|
|
51
|
-
*
|
|
52
|
-
* assert.deepStrictEqual(remainder, ['Grace', 'Katherine']);
|
|
53
|
-
*
|
|
54
|
-
* assert.isTrue(remainder.length === 2);
|
|
55
|
-
* }
|
|
56
|
-
*
|
|
57
|
-
* {
|
|
58
|
-
* const values = [1, 2, 3] as const;
|
|
59
|
-
*
|
|
60
|
-
* const remainder = Arr.rest(values);
|
|
61
|
-
*
|
|
62
|
-
* const emptyRemainder = Arr.rest([1] as const);
|
|
63
|
-
*
|
|
64
|
-
* assert.deepStrictEqual(remainder, [2, 3] as const);
|
|
65
|
-
*
|
|
66
|
-
* assert.deepStrictEqual(emptyRemainder, [] as const);
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
const tail = (array) =>
|
|
71
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
72
|
-
array.slice(1);
|
|
73
|
-
/**
|
|
74
|
-
* Returns all elements of an array except the last one.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* const queue = ['task-1', 'task-2', 'task-3'] as const;
|
|
80
|
-
*
|
|
81
|
-
* const withoutLast = Arr.butLast(queue);
|
|
82
|
-
*
|
|
83
|
-
* assert.deepStrictEqual(withoutLast, ['task-1', 'task-2']);
|
|
84
|
-
*
|
|
85
|
-
* assert.isTrue(withoutLast.length === 2);
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
const butLast = (array) =>
|
|
89
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
90
|
-
(isEmpty(array) ? [] : array.slice(0, -1));
|
|
41
|
+
const tail = (array) => (
|
|
42
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
43
|
+
array.slice(1)
|
|
44
|
+
);
|
|
45
|
+
const butLast = (array) => (
|
|
46
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
47
|
+
isEmpty(array) ? [] : array.slice(0, -1)
|
|
48
|
+
);
|
|
91
49
|
function take(...args) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
case 1: {
|
|
98
|
-
const [num] = args;
|
|
99
|
-
return (array) => take(array, num);
|
|
100
|
-
}
|
|
50
|
+
switch (args.length) {
|
|
51
|
+
case 2: {
|
|
52
|
+
const [array, num] = args;
|
|
53
|
+
return sliceClamped(array, 0, num);
|
|
101
54
|
}
|
|
55
|
+
case 1: {
|
|
56
|
+
const [num] = args;
|
|
57
|
+
return (array) => take(array, num);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
102
60
|
}
|
|
103
61
|
function takeLast(...args) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
62
|
+
switch (args.length) {
|
|
63
|
+
case 2: {
|
|
64
|
+
const [array, num] = args;
|
|
65
|
+
return sliceClamped(array, Uint32.sub(size(array), num), size(array));
|
|
66
|
+
}
|
|
67
|
+
case 1: {
|
|
68
|
+
const [num] = args;
|
|
69
|
+
return (array) => takeLast(array, num);
|
|
113
70
|
}
|
|
71
|
+
}
|
|
114
72
|
}
|
|
115
73
|
function skip(...args) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
case 1: {
|
|
122
|
-
const [num] = args;
|
|
123
|
-
return (array) => skip(array, num);
|
|
124
|
-
}
|
|
74
|
+
switch (args.length) {
|
|
75
|
+
case 2: {
|
|
76
|
+
const [array, num] = args;
|
|
77
|
+
return sliceClamped(array, num, size(array));
|
|
125
78
|
}
|
|
79
|
+
case 1: {
|
|
80
|
+
const [num] = args;
|
|
81
|
+
return (array) => skip(array, num);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
126
84
|
}
|
|
127
85
|
function skipLast(...args) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
86
|
+
switch (args.length) {
|
|
87
|
+
case 2: {
|
|
88
|
+
const [array, num] = args;
|
|
89
|
+
return sliceClamped(array, 0, Uint32.sub(size(array), num));
|
|
90
|
+
}
|
|
91
|
+
case 1: {
|
|
92
|
+
const [num] = args;
|
|
93
|
+
return (array) => skipLast(array, num);
|
|
137
94
|
}
|
|
95
|
+
}
|
|
138
96
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Alias for `tail`.
|
|
141
|
-
*
|
|
142
|
-
* @see {@link tail}
|
|
143
|
-
*/
|
|
144
97
|
const rest = tail;
|
|
145
|
-
/**
|
|
146
|
-
* Alias for `skip`.
|
|
147
|
-
*
|
|
148
|
-
* @see {@link skip}
|
|
149
|
-
*/
|
|
150
98
|
const drop = skip;
|
|
151
99
|
|
|
152
100
|
export { butLast, drop, rest, skip, skipLast, tail, take, takeLast };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-utils-slicing.mjs","sources":["../../../src/array/impl/array-utils-slicing.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"array-utils-slicing.mjs","sources":["../../../src/array/impl/array-utils-slicing.mts"],"sourcesContent":["import { type List, type NonEmptyArray, type SmallUint } from 'ts-type-forge';\nimport { Uint32 } from '../../number/index.mjs';\nimport { type SizeType } from '../../types.mjs';\nimport { size } from './array-utils-size.mjs';\nimport { sliceClamped } from './array-utils-slice-clamped.mjs';\nimport { isEmpty } from './array-utils-validation.mjs';\n\n/**\n * Returns all elements of an array except the first one.\n *\n * @example\n *\n * ```ts\n * {\n * const scientists = ['Ada', 'Grace', 'Katherine'] as const;\n *\n * const remainder = Arr.tail(scientists);\n *\n * assert.deepStrictEqual(remainder, ['Grace', 'Katherine']);\n *\n * assert.isTrue(remainder.length === 2);\n * }\n *\n * {\n * const values = [1, 2, 3] as const;\n *\n * const remainder = Arr.rest(values);\n *\n * const emptyRemainder = Arr.rest([1] as const);\n *\n * assert.deepStrictEqual(remainder, [2, 3] as const);\n *\n * assert.deepStrictEqual(emptyRemainder, [] as const);\n * }\n * ```\n */\nexport const tail = <const Ar extends readonly unknown[]>(\n array: Ar,\n): List.Tail<Ar> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n array.slice(1) as unknown as List.Tail<Ar>;\n\n/**\n * Returns all elements of an array except the last one.\n *\n * @example\n *\n * ```ts\n * const queue = ['task-1', 'task-2', 'task-3'] as const;\n *\n * const withoutLast = Arr.butLast(queue);\n *\n * assert.deepStrictEqual(withoutLast, ['task-1', 'task-2']);\n *\n * assert.isTrue(withoutLast.length === 2);\n * ```\n */\nexport const butLast = <const Ar extends readonly unknown[]>(\n array: Ar,\n): List.ButLast<Ar> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n (isEmpty(array) ? [] : array.slice(0, -1)) as unknown as List.ButLast<Ar>;\n\n/**\n * Takes the first N elements from an array.\n *\n * @example\n *\n * ```ts\n * const values = [1, 2, 3, 4] as const;\n *\n * const firstTwo = Arr.take(values, 2);\n *\n * const firstThree = Arr.take(3)(values);\n *\n * assert.deepStrictEqual(firstTwo, [1, 2]);\n *\n * assert.deepStrictEqual(firstThree, [1, 2, 3]);\n * ```\n */\nexport function take<\n const Ar extends readonly unknown[],\n N extends SizeType.ArgArr,\n>(\n array: Ar,\n num: N,\n): N extends SmallUint\n ? List.Take<N, Ar>\n : N extends SizeType.ArgArrPositive\n ? Ar extends NonEmptyArray<unknown>\n ? NonEmptyArray<Ar[number]>\n : readonly Ar[number][]\n : readonly Ar[number][];\n\nexport function take<N extends SizeType.ArgArr>(\n num: N,\n): <const Ar extends readonly unknown[]>(\n array: Ar,\n) => N extends SmallUint\n ? List.Take<N, Ar>\n : N extends SizeType.ArgArrPositive\n ? Ar extends NonEmptyArray<unknown>\n ? NonEmptyArray<Ar[number]>\n : readonly Ar[number][]\n : readonly Ar[number][];\n\nexport function take<E>(\n ...args:\n | readonly [array: readonly E[], num: SizeType.ArgArr]\n | readonly [num: SizeType.ArgArr]\n): readonly E[] | ((array: readonly E[]) => readonly E[]) {\n switch (args.length) {\n case 2: {\n const [array, num] = args;\n\n return sliceClamped(array, 0, num);\n }\n\n case 1: {\n const [num] = args;\n\n return (array) => take(array, num);\n }\n }\n}\n\n/**\n * Takes the last N elements from an array.\n *\n * @example\n *\n * ```ts\n * const values = [1, 2, 3, 4] as const;\n *\n * const lastTwo = Arr.takeLast(values, 2);\n *\n * const lastThree = Arr.takeLast(3)(values);\n *\n * assert.deepStrictEqual(lastTwo, [3, 4]);\n *\n * assert.deepStrictEqual(lastThree, [2, 3, 4]);\n * ```\n */\nexport function takeLast<\n const Ar extends readonly unknown[],\n N extends SizeType.ArgArr,\n>(\n array: Ar,\n num: N,\n): N extends SmallUint\n ? List.TakeLast<N, Ar>\n : N extends SizeType.ArgArrPositive\n ? Ar extends NonEmptyArray<unknown>\n ? NonEmptyArray<Ar[number]>\n : readonly Ar[number][]\n : readonly Ar[number][];\n\nexport function takeLast<N extends SizeType.ArgArr>(\n num: N,\n): <const Ar extends readonly unknown[]>(\n array: Ar,\n) => N extends SmallUint\n ? List.TakeLast<N, Ar>\n : N extends SizeType.ArgArrPositive\n ? Ar extends NonEmptyArray<unknown>\n ? NonEmptyArray<Ar[number]>\n : readonly Ar[number][]\n : readonly Ar[number][];\n\nexport function takeLast<E>(\n ...args:\n | readonly [array: readonly E[], num: SizeType.ArgArr]\n | readonly [num: SizeType.ArgArr]\n): readonly E[] | ((array: readonly E[]) => readonly E[]) {\n switch (args.length) {\n case 2: {\n const [array, num] = args;\n\n return sliceClamped(array, Uint32.sub(size(array), num), size(array));\n }\n\n case 1: {\n const [num] = args;\n\n return (array) => takeLast(array, num);\n }\n }\n}\n\n/**\n * Skips the first N elements of an array.\n *\n * @example\n *\n * ```ts\n * const values = ['a', 'b', 'c', 'd'] as const;\n *\n * const withoutFirstTwo = Arr.skip(values, 2);\n *\n * const withoutFirstThree = Arr.skip(3)(values);\n *\n * assert.deepStrictEqual(withoutFirstTwo, ['c', 'd']);\n *\n * assert.deepStrictEqual(withoutFirstThree, ['d']);\n * ```\n */\nexport function skip<\n const Ar extends readonly unknown[],\n N extends SizeType.ArgArr,\n>(\n array: Ar,\n num: N,\n): N extends SmallUint ? List.Skip<N, Ar> : readonly Ar[number][];\n\n// curried version\nexport function skip<N extends SizeType.ArgArr>(\n num: N,\n): <const Ar extends readonly unknown[]>(\n array: Ar,\n) => N extends SmallUint ? List.Skip<N, Ar> : readonly Ar[number][];\n\nexport function skip<E>(\n ...args: readonly [readonly E[], SizeType.ArgArr] | readonly [SizeType.ArgArr]\n): readonly E[] | ((array: readonly E[]) => readonly E[]) {\n switch (args.length) {\n case 2: {\n const [array, num] = args;\n\n return sliceClamped(array, num, size(array));\n }\n\n case 1: {\n const [num] = args;\n\n return (array) => skip(array, num);\n }\n }\n}\n\n/**\n * Skips the last N elements of an array.\n *\n * @example\n *\n * ```ts\n * const values = ['a', 'b', 'c', 'd'] as const;\n *\n * const withoutLastTwo = Arr.skipLast(values, 2);\n *\n * const withoutLastThree = Arr.skipLast(3)(values);\n *\n * assert.deepStrictEqual(withoutLastTwo, ['a', 'b']);\n *\n * assert.deepStrictEqual(withoutLastThree, ['a']);\n * ```\n */\nexport function skipLast<\n const Ar extends readonly unknown[],\n N extends SizeType.ArgArr,\n>(\n array: Ar,\n num: N,\n): N extends SmallUint ? List.SkipLast<N, Ar> : readonly Ar[number][];\n\n// curried version\nexport function skipLast<N extends SizeType.ArgArr>(\n num: N,\n): <const Ar extends readonly unknown[]>(\n array: Ar,\n) => N extends SmallUint ? List.SkipLast<N, Ar> : readonly Ar[number][];\n\nexport function skipLast<E>(\n ...args:\n | readonly [array: readonly E[], num: SizeType.ArgArr]\n | readonly [num: SizeType.ArgArr]\n): readonly E[] | ((array: readonly E[]) => readonly E[]) {\n switch (args.length) {\n case 2: {\n const [array, num] = args;\n\n return sliceClamped(array, 0, Uint32.sub(size(array), num));\n }\n\n case 1: {\n const [num] = args;\n\n return (array) => skipLast(array, num);\n }\n }\n}\n\n/**\n * Alias for `tail`.\n *\n * @see {@link tail}\n */\nexport const rest = tail;\n\n/**\n * Alias for `skip`.\n *\n * @see {@link skip}\n */\nexport const drop = skip;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,OAAO,CAClB,KAAA;AAAA;AAAA,EAGA,KAAA,CAAM,MAAM,CAAC;AAAA;AAiBR,MAAM,UAAU,CACrB,KAAA;AAAA;AAAA,EAGC,OAAA,CAAQ,KAAK,CAAA,GAAI,KAAK,KAAA,CAAM,KAAA,CAAM,GAAG,EAAE;AAAA;AA6CnC,SAAS,QACX,IAAA,EAGqD;AACxD,EAAA,QAAQ,KAAK,MA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A,IACnC;AAAA;AAEJ;AAkCO,SAAS,YACX,IAAA,EAGqD;AACxD,EAAA,QAAQ,KAAK,MAAA;AAAQ,IACnB,KAAK,CAAA,EAAG;AACN,MAAA,MAAM,CAAC,KAAA,EAAO,GAAG,CAAA,GAAI,IAAA;AAErB,MAAA,OAAO,YAAA,CAAa,OAAO,CAAA,EAAG,MAAA,CAAO,IAAI,IAAA,CAAK,KAAK,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,IAC5D;AAAA,IAEA,KAAK,CAAA,EAAG;AACN,MAAA,MAAM,CAAC,GAAG,CAAA,GAAI,IAAA;AAEd,MAAA,OAAO,CAAC,KAAA,KAAU,QAAA,CAAS,KAAA,EAAO,GAAG,CAAA;AAAA,IACvC;AAAA;AAEJ;AAOO,MAAM,IAAA,GAAO;AAOb,MAAM,IAAA,GAAO;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FixedLengthTuple, type IsFixedLengthList, type List, type NonEmptyArray, type PositiveInt, type Primitive, type SafeUintWithSmallInt, type WithSmallInt } from 'ts-type-forge';
|
|
2
2
|
import { IMap } from '../../collections/index.mjs';
|
|
3
3
|
import { type ArrayIndex, type MapSetKeyType, type SizeType } from '../../types.mjs';
|
|
4
4
|
/**
|
|
@@ -97,7 +97,7 @@ export declare const toReversed: <const Ar extends readonly unknown[]>(array: Ar
|
|
|
97
97
|
* assert.deepStrictEqual(alphabetical, expectedWords);
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
|
-
export declare const toSorted: <const Ar extends readonly unknown[]>(...[array, comparator]: Ar extends readonly number[] ? readonly [array: Ar, comparator?: (x: Ar[number], y: Ar[number]) => number] : readonly [array: Ar, comparator: (x: Ar[number], y: Ar[number]) => number]) => IsFixedLengthList<Ar> extends true ?
|
|
100
|
+
export declare const toSorted: <const Ar extends readonly unknown[]>(...[array, comparator]: Ar extends readonly number[] ? readonly [array: Ar, comparator?: (x: Ar[number], y: Ar[number]) => number] : readonly [array: Ar, comparator: (x: Ar[number], y: Ar[number]) => number]) => IsFixedLengthList<Ar> extends true ? FixedLengthTuple<Ar['length'], Ar[number]> : Ar extends NonEmptyArray<unknown> ? NonEmptyArray<Ar[number]> : readonly Ar[number][];
|
|
101
101
|
/**
|
|
102
102
|
* Sorts an array by a mapped value.
|
|
103
103
|
*
|
|
@@ -138,8 +138,8 @@ export declare const toSorted: <const Ar extends readonly unknown[]>(...[array,
|
|
|
138
138
|
* );
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
|
-
export declare function toSortedBy<const Ar extends readonly unknown[]>(array: Ar, comparatorValueMapper: (value: Ar[number]) => number, comparator?: (x: number, y: number) => number): IsFixedLengthList<Ar> extends true ?
|
|
142
|
-
export declare function toSortedBy<const Ar extends readonly unknown[], const V>(array: Ar, comparatorValueMapper: (value: Ar[number]) => V, comparator: (x: V, y: V) => number): IsFixedLengthList<Ar> extends true ?
|
|
141
|
+
export declare function toSortedBy<const Ar extends readonly unknown[]>(array: Ar, comparatorValueMapper: (value: Ar[number]) => number, comparator?: (x: number, y: number) => number): IsFixedLengthList<Ar> extends true ? FixedLengthTuple<Ar['length'], Ar[number]> : Ar extends NonEmptyArray<unknown> ? NonEmptyArray<Ar[number]> : readonly Ar[number][];
|
|
142
|
+
export declare function toSortedBy<const Ar extends readonly unknown[], const V>(array: Ar, comparatorValueMapper: (value: Ar[number]) => V, comparator: (x: V, y: V) => number): IsFixedLengthList<Ar> extends true ? FixedLengthTuple<Ar['length'], Ar[number]> : Ar extends NonEmptyArray<unknown> ? NonEmptyArray<Ar[number]> : readonly Ar[number][];
|
|
143
143
|
/**
|
|
144
144
|
* Filters an array based on a predicate function.
|
|
145
145
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-utils-transformation.d.mts","sourceRoot":"","sources":["../../../src/array/impl/array-utils-transformation.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"array-utils-transformation.d.mts","sourceRoot":"","sources":["../../../src/array/impl/array-utils-transformation.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAET,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAInD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACd,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,EACxD,KAAK,EAAE,EAAE,EACT,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,GACjD,QAAQ,CAAC;KAAG,CAAC,IAAI,MAAM,EAAE,GAAG,CAAC;CAAE,CAAC,CAAC;AAGpC,wBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EACtB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,GACtC,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,CAAC,EAAE,EAC/B,KAAK,EAAE,EAAE,KACN,QAAQ,CAAC;KAAG,CAAC,IAAI,MAAM,EAAE,GAAG,CAAC;CAAE,CAAC,CAAC;AAuBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,EACzD,KAAK,EAAE,EAAE,EACT,OAAO,EAAE,CACP,WAAW,EAAE,CAAC,EACd,YAAY,EAAE,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