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
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
2
|
|
|
3
|
-
const typeNameInMessage =
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const typeNameInMessage = "an integer in [-128, 127]";
|
|
4
|
+
const {
|
|
5
|
+
MAX_VALUE,
|
|
6
|
+
MIN_VALUE,
|
|
7
|
+
castType: castTypeImpl,
|
|
8
|
+
clamp: clampImpl,
|
|
9
|
+
is: isImpl,
|
|
10
|
+
random: randomImpl
|
|
11
|
+
} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
12
|
+
integerOrSafeInteger: "SafeInteger",
|
|
13
|
+
MIN_VALUE: -128,
|
|
14
|
+
MAX_VALUE: 127,
|
|
15
|
+
typeNameInMessage
|
|
9
16
|
});
|
|
10
17
|
const is = (x) => isImpl(x);
|
|
11
|
-
const castType = (x) =>
|
|
12
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
13
|
-
castTypeImpl(x)
|
|
18
|
+
const castType = (x) => (
|
|
19
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
20
|
+
castTypeImpl(x)
|
|
21
|
+
);
|
|
14
22
|
const clamp = (a) => castType(clampImpl(a));
|
|
15
|
-
const abs = (x) =>
|
|
16
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
17
|
-
Math.abs(x)
|
|
23
|
+
const abs = (x) => (
|
|
24
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
25
|
+
Math.abs(x)
|
|
26
|
+
);
|
|
18
27
|
const min_ = (...values) => castType(Math.min(...values));
|
|
19
28
|
const max_ = (...values) => castType(Math.max(...values));
|
|
20
29
|
const pow = (x, y) => clamp(x ** y);
|
|
@@ -23,142 +32,107 @@ const sub = (x, y) => clamp(x - y);
|
|
|
23
32
|
const mul = (x, y) => clamp(x * y);
|
|
24
33
|
const div = (x, y) => clamp(Math.floor(x / y));
|
|
25
34
|
const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
26
|
-
/**
|
|
27
|
-
* Type guard that checks if a value is an 8-bit signed integer.
|
|
28
|
-
*
|
|
29
|
-
* An Int8 is a signed integer in the range [-128, 127], representing values
|
|
30
|
-
* that fit in exactly 8 bits of memory.
|
|
31
|
-
*
|
|
32
|
-
* @param value - The value to check
|
|
33
|
-
* @returns `true` if the value is an Int8, `false` otherwise
|
|
34
|
-
*/
|
|
35
35
|
const isInt8 = is;
|
|
36
|
-
/**
|
|
37
|
-
* Casts a number to an Int8 branded type.
|
|
38
|
-
*
|
|
39
|
-
* This function validates that the input is within the Int8 range [-128, 127]
|
|
40
|
-
* and is an integer, then returns it with the Int8 brand.
|
|
41
|
-
*
|
|
42
|
-
* @param value - The value to cast
|
|
43
|
-
* @returns The value as an Int8 branded type
|
|
44
|
-
* @throws {TypeError} If the value is not a valid 8-bit signed integer
|
|
45
|
-
*/
|
|
46
36
|
const asInt8 = castType;
|
|
47
|
-
/**
|
|
48
|
-
* Namespace providing type-safe operations for Int8 (8-bit signed integer)
|
|
49
|
-
* branded types.
|
|
50
|
-
*
|
|
51
|
-
* Int8 represents signed integers in the range [-128, 127], equivalent to a
|
|
52
|
-
* signed byte in many programming languages. All operations automatically clamp
|
|
53
|
-
* results to stay within this range, preventing overflow/underflow issues.
|
|
54
|
-
*
|
|
55
|
-
* This type is useful for:
|
|
56
|
-
*
|
|
57
|
-
* - Binary data processing (signed bytes)
|
|
58
|
-
* - Small integer values with known bounds
|
|
59
|
-
* - Embedded systems programming
|
|
60
|
-
* - Memory-efficient integer storage
|
|
61
|
-
* - Image processing (signed pixel offsets)
|
|
62
|
-
*/
|
|
63
37
|
const Int8 = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Type guard that checks if a value is an 8-bit signed integer.
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to check
|
|
42
|
+
* @returns `true` if the value is in range [-128, 127] and is an integer
|
|
43
|
+
* @see {@link isInt8} for usage examples
|
|
44
|
+
*/
|
|
45
|
+
is,
|
|
46
|
+
/**
|
|
47
|
+
* The minimum value for an 8-bit signed integer.
|
|
48
|
+
*
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
51
|
+
MIN_VALUE,
|
|
52
|
+
/**
|
|
53
|
+
* The maximum value for an 8-bit signed integer.
|
|
54
|
+
*
|
|
55
|
+
* @readonly
|
|
56
|
+
*/
|
|
57
|
+
MAX_VALUE,
|
|
58
|
+
/**
|
|
59
|
+
* Returns the minimum value from a list of Int8 values.
|
|
60
|
+
*
|
|
61
|
+
* @param values - The Int8 values to compare (at least one required)
|
|
62
|
+
* @returns The smallest value as an Int8
|
|
63
|
+
*/
|
|
64
|
+
min: min_,
|
|
65
|
+
/**
|
|
66
|
+
* Returns the maximum value from a list of Int8 values.
|
|
67
|
+
*
|
|
68
|
+
* @param values - The Int8 values to compare (at least one required)
|
|
69
|
+
* @returns The largest value as an Int8
|
|
70
|
+
*/
|
|
71
|
+
max: max_,
|
|
72
|
+
/**
|
|
73
|
+
* Clamps a number to the Int8 range.
|
|
74
|
+
*
|
|
75
|
+
* @param value The number to clamp.
|
|
76
|
+
* @returns The value clamped to [-128, 127] as an Int8.
|
|
77
|
+
*/
|
|
78
|
+
clamp,
|
|
79
|
+
/**
|
|
80
|
+
* Returns the absolute value of an Int8.
|
|
81
|
+
*
|
|
82
|
+
* @param value The Int8 value.
|
|
83
|
+
* @returns The absolute value as an Int8, clamped to valid range.
|
|
84
|
+
*/
|
|
85
|
+
abs,
|
|
86
|
+
/**
|
|
87
|
+
* Generates a random Int8 value within the specified range (inclusive).
|
|
88
|
+
*
|
|
89
|
+
* Both bounds are inclusive. If min > max, they are automatically swapped.
|
|
90
|
+
*
|
|
91
|
+
* @param min - The minimum value (inclusive)
|
|
92
|
+
* @param max - The maximum value (inclusive)
|
|
93
|
+
* @returns A random Int8 in the range [min, max]
|
|
94
|
+
*/
|
|
95
|
+
random,
|
|
96
|
+
/**
|
|
97
|
+
* Raises x to the power of y, clamped to Int8 range.
|
|
98
|
+
*
|
|
99
|
+
* @param x - The base
|
|
100
|
+
* @param y - The exponent
|
|
101
|
+
* @returns `x ** y` clamped to [-128, 127]
|
|
102
|
+
*/
|
|
103
|
+
pow,
|
|
104
|
+
/**
|
|
105
|
+
* Adds two Int8 values, clamped to Int8 range.
|
|
106
|
+
*
|
|
107
|
+
* @param x - First operand
|
|
108
|
+
* @param y - Second operand
|
|
109
|
+
* @returns `x + y` clamped to [-128, 127]
|
|
110
|
+
*/
|
|
111
|
+
add,
|
|
112
|
+
/**
|
|
113
|
+
* Subtracts two Int8 values, clamped to Int8 range.
|
|
114
|
+
*
|
|
115
|
+
* @param x - First operand
|
|
116
|
+
* @param y - Second operand
|
|
117
|
+
* @returns `x - y` clamped to [-128, 127]
|
|
118
|
+
*/
|
|
119
|
+
sub,
|
|
120
|
+
/**
|
|
121
|
+
* Multiplies two Int8 values, clamped to Int8 range.
|
|
122
|
+
*
|
|
123
|
+
* @param x - First operand
|
|
124
|
+
* @param y - Second operand
|
|
125
|
+
* @returns `x * y` clamped to [-128, 127]
|
|
126
|
+
*/
|
|
127
|
+
mul,
|
|
128
|
+
/**
|
|
129
|
+
* Divides two Int8 values, clamped to Int8 range.
|
|
130
|
+
*
|
|
131
|
+
* @param x - The dividend
|
|
132
|
+
* @param y - The divisor (cannot be 0)
|
|
133
|
+
* @returns `⌊x / y⌋` clamped to [-128, 127]
|
|
134
|
+
*/
|
|
135
|
+
div
|
|
162
136
|
};
|
|
163
137
|
|
|
164
138
|
export { Int8, asInt8, isInt8 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int8.mjs","sources":["../../../src/number/enum/int8.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"int8.mjs","sources":["../../../src/number/enum/int8.mts"],"sourcesContent":["import {\n type AbsoluteValue,\n type Int16,\n type Int8 as TtfImported_Int8,\n} from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Int8 = TtfImported_Int8;\n\nconst typeNameInMessage = 'an integer in [-128, 127]';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n Int16,\n -128,\n 127\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: -128,\n MAX_VALUE: 127,\n typeNameInMessage,\n} as const);\n\nconst is = (x: number): x is Int8 => isImpl(x);\n\nconst castType = (x: number): Int8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Int8;\n\nconst clamp = (a: number): Int8 => castType(clampImpl(a));\n\nconst abs = <N extends Int8>(x: N): AbsoluteValue<N> =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n Math.abs(x) as unknown as AbsoluteValue<N>;\n\nconst min_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Int8[]): Int8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Int8, y: Int8): Int8 => clamp(x ** y);\n\nconst add = (x: Int8, y: Int8): Int8 => clamp(x + y);\n\nconst sub = (x: Int8, y: Int8): Int8 => clamp(x - y);\n\nconst mul = (x: Int8, y: Int8): Int8 => clamp(x * y);\n\nconst div = (x: Int8, y: Exclude<Int8, 0>): Int8 => clamp(Math.floor(x / y));\n\nconst random = (min: Int8, max: Int8): Int8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Type guard that checks if a value is an 8-bit signed integer.\n *\n * An Int8 is a signed integer in the range [-128, 127], representing values\n * that fit in exactly 8 bits of memory.\n *\n * @param value - The value to check\n * @returns `true` if the value is an Int8, `false` otherwise\n */\nexport const isInt8 = is;\n\n/**\n * Casts a number to an Int8 branded type.\n *\n * This function validates that the input is within the Int8 range [-128, 127]\n * and is an integer, then returns it with the Int8 brand.\n *\n * @param value - The value to cast\n * @returns The value as an Int8 branded type\n * @throws {TypeError} If the value is not a valid 8-bit signed integer\n */\nexport const asInt8 = castType;\n\n/**\n * Namespace providing type-safe operations for Int8 (8-bit signed integer)\n * branded types.\n *\n * Int8 represents signed integers in the range [-128, 127], equivalent to a\n * signed byte in many programming languages. All operations automatically clamp\n * results to stay within this range, preventing overflow/underflow issues.\n *\n * This type is useful for:\n *\n * - Binary data processing (signed bytes)\n * - Small integer values with known bounds\n * - Embedded systems programming\n * - Memory-efficient integer storage\n * - Image processing (signed pixel offsets)\n */\nexport const Int8 = {\n /**\n * Type guard that checks if a value is an 8-bit signed integer.\n *\n * @param value - The value to check\n * @returns `true` if the value is in range [-128, 127] and is an integer\n * @see {@link isInt8} for usage examples\n */\n is,\n\n /**\n * The minimum value for an 8-bit signed integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for an 8-bit signed integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the minimum value from a list of Int8 values.\n *\n * @param values - The Int8 values to compare (at least one required)\n * @returns The smallest value as an Int8\n */\n min: min_,\n\n /**\n * Returns the maximum value from a list of Int8 values.\n *\n * @param values - The Int8 values to compare (at least one required)\n * @returns The largest value as an Int8\n */\n max: max_,\n\n /**\n * Clamps a number to the Int8 range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [-128, 127] as an Int8.\n */\n clamp,\n\n /**\n * Returns the absolute value of an Int8.\n *\n * @param value The Int8 value.\n * @returns The absolute value as an Int8, clamped to valid range.\n */\n abs,\n\n /**\n * Generates a random Int8 value within the specified range (inclusive).\n *\n * Both bounds are inclusive. If min > max, they are automatically swapped.\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random Int8 in the range [min, max]\n */\n random,\n\n /**\n * Raises x to the power of y, clamped to Int8 range.\n *\n * @param x - The base\n * @param y - The exponent\n * @returns `x ** y` clamped to [-128, 127]\n */\n pow,\n\n /**\n * Adds two Int8 values, clamped to Int8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x + y` clamped to [-128, 127]\n */\n add,\n\n /**\n * Subtracts two Int8 values, clamped to Int8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x - y` clamped to [-128, 127]\n */\n sub,\n\n /**\n * Multiplies two Int8 values, clamped to Int8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x * y` clamped to [-128, 127]\n */\n mul,\n\n /**\n * Divides two Int8 values, clamped to Int8 range.\n *\n * @param x - The dividend\n * @param y - The divisor (cannot be 0)\n * @returns `⌊x / y⌋` clamped to [-128, 127]\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Int8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Int16,\n 'int' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAUA,MAAM,iBAAA,GAAoB,2BAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA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IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA;AACF;;;;"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
2
|
|
|
3
|
-
const typeNameInMessage =
|
|
4
|
-
const {
|
|
5
|
-
|
|
3
|
+
const typeNameInMessage = "an non-negative integer less than 256";
|
|
4
|
+
const {
|
|
5
|
+
MAX_VALUE,
|
|
6
|
+
MIN_VALUE,
|
|
7
|
+
castType: castTypeImpl,
|
|
8
|
+
clamp: clampImpl,
|
|
9
|
+
is: isImpl,
|
|
10
|
+
random: randomImpl
|
|
11
|
+
} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger(
|
|
12
|
+
{
|
|
13
|
+
integerOrSafeInteger: "SafeInteger",
|
|
6
14
|
MIN_VALUE: 0,
|
|
7
15
|
MAX_VALUE: 255,
|
|
8
|
-
typeNameInMessage
|
|
9
|
-
}
|
|
16
|
+
typeNameInMessage
|
|
17
|
+
}
|
|
18
|
+
);
|
|
10
19
|
const is = (x) => isImpl(x);
|
|
11
|
-
const castType = (x) =>
|
|
12
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
13
|
-
castTypeImpl(x)
|
|
20
|
+
const castType = (x) => (
|
|
21
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
22
|
+
castTypeImpl(x)
|
|
23
|
+
);
|
|
14
24
|
const clamp = (a) => castType(clampImpl(a));
|
|
15
25
|
const min_ = (...values) => castType(Math.min(...values));
|
|
16
26
|
const max_ = (...values) => castType(Math.max(...values));
|
|
@@ -20,122 +30,98 @@ const sub = (x, y) => clamp(x - y);
|
|
|
20
30
|
const mul = (x, y) => clamp(x * y);
|
|
21
31
|
const div = (x, y) => clamp(Math.floor(x / y));
|
|
22
32
|
const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
23
|
-
/**
|
|
24
|
-
* Checks if a number is a Uint8 (8-bit unsigned integer in the range [0, 255]).
|
|
25
|
-
*
|
|
26
|
-
* @param value The value to check.
|
|
27
|
-
* @returns `true` if the value is a Uint8, `false` otherwise.
|
|
28
|
-
*/
|
|
29
33
|
const isUint8 = is;
|
|
30
|
-
/**
|
|
31
|
-
* Casts a number to a Uint8 type. This function validates that the input is
|
|
32
|
-
* within the Uint8 range [0, 255] and is an integer, then returns it with the
|
|
33
|
-
* Uint8 brand.
|
|
34
|
-
*
|
|
35
|
-
* @param value The value to cast.
|
|
36
|
-
* @returns The value as a Uint8 type.
|
|
37
|
-
* @throws {TypeError} If the value is not a valid 8-bit unsigned integer.
|
|
38
|
-
*/
|
|
39
34
|
const asUint8 = castType;
|
|
40
|
-
/**
|
|
41
|
-
* Namespace providing type-safe arithmetic operations for 8-bit unsigned
|
|
42
|
-
* integers.
|
|
43
|
-
*
|
|
44
|
-
* All operations automatically clamp results to the valid Uint8 range [0, 255].
|
|
45
|
-
* This ensures that all arithmetic maintains the 8-bit unsigned integer
|
|
46
|
-
* constraint, with negative results clamped to 0 and overflow results clamped
|
|
47
|
-
* to MAX_VALUE.
|
|
48
|
-
*/
|
|
49
35
|
const Uint8 = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Type guard that checks if a value is an 8-bit unsigned integer.
|
|
38
|
+
*
|
|
39
|
+
* @param value The value to check.
|
|
40
|
+
* @returns `true` if the value is an 8-bit unsigned integer, `false`
|
|
41
|
+
* otherwise.
|
|
42
|
+
*/
|
|
43
|
+
is,
|
|
44
|
+
/**
|
|
45
|
+
* The minimum value for an 8-bit unsigned integer.
|
|
46
|
+
*
|
|
47
|
+
* @readonly
|
|
48
|
+
*/
|
|
49
|
+
MIN_VALUE,
|
|
50
|
+
/**
|
|
51
|
+
* The maximum value for an 8-bit unsigned integer.
|
|
52
|
+
*
|
|
53
|
+
* @readonly
|
|
54
|
+
*/
|
|
55
|
+
MAX_VALUE,
|
|
56
|
+
/**
|
|
57
|
+
* Returns the larger of the given Uint8 values.
|
|
58
|
+
*
|
|
59
|
+
* @param values The Uint8 values to compare.
|
|
60
|
+
* @returns The maximum value as a Uint8.
|
|
61
|
+
*/
|
|
62
|
+
max: max_,
|
|
63
|
+
/**
|
|
64
|
+
* Returns the smaller of the given Uint8 values.
|
|
65
|
+
*
|
|
66
|
+
* @param values The Uint8 values to compare.
|
|
67
|
+
* @returns The minimum value as a Uint8.
|
|
68
|
+
*/
|
|
69
|
+
min: min_,
|
|
70
|
+
/**
|
|
71
|
+
* Clamps a number to the Uint8 range.
|
|
72
|
+
*
|
|
73
|
+
* @param value The number to clamp.
|
|
74
|
+
* @returns The value clamped to [0, 255] as a Uint8.
|
|
75
|
+
*/
|
|
76
|
+
clamp,
|
|
77
|
+
/**
|
|
78
|
+
* Generates a random Uint8 value within the specified range.
|
|
79
|
+
*
|
|
80
|
+
* @param min The minimum value (inclusive).
|
|
81
|
+
* @param max The maximum value (inclusive).
|
|
82
|
+
* @returns A random Uint8 between min and max.
|
|
83
|
+
*/
|
|
84
|
+
random,
|
|
85
|
+
/**
|
|
86
|
+
* Raises x to the power of y, clamped to Uint8 range.
|
|
87
|
+
*
|
|
88
|
+
* @param x - The base
|
|
89
|
+
* @param y - The exponent
|
|
90
|
+
* @returns `x ** y` clamped to [0, 255]
|
|
91
|
+
*/
|
|
92
|
+
pow,
|
|
93
|
+
/**
|
|
94
|
+
* Adds two Uint8 values, clamped to Uint8 range.
|
|
95
|
+
*
|
|
96
|
+
* @param x - First operand
|
|
97
|
+
* @param y - Second operand
|
|
98
|
+
* @returns `x + y` clamped to [0, 255]
|
|
99
|
+
*/
|
|
100
|
+
add,
|
|
101
|
+
/**
|
|
102
|
+
* Subtracts two Uint8 values, clamped to Uint8 range.
|
|
103
|
+
*
|
|
104
|
+
* @param x - First operand
|
|
105
|
+
* @param y - Second operand
|
|
106
|
+
* @returns `x - y` clamped to [0, 255]
|
|
107
|
+
*/
|
|
108
|
+
sub,
|
|
109
|
+
/**
|
|
110
|
+
* Multiplies two Uint8 values, clamped to Uint8 range.
|
|
111
|
+
*
|
|
112
|
+
* @param x - First operand
|
|
113
|
+
* @param y - Second operand
|
|
114
|
+
* @returns `x * y` clamped to [0, 255]
|
|
115
|
+
*/
|
|
116
|
+
mul,
|
|
117
|
+
/**
|
|
118
|
+
* Divides two Uint8 values, clamped to Uint8 range.
|
|
119
|
+
*
|
|
120
|
+
* @param x - The dividend
|
|
121
|
+
* @param y - The divisor (cannot be 0)
|
|
122
|
+
* @returns `⌊x / y⌋` clamped to [0, 255]
|
|
123
|
+
*/
|
|
124
|
+
div
|
|
139
125
|
};
|
|
140
126
|
|
|
141
127
|
export { Uint8, asUint8, isUint8 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8.mjs","sources":["../../../src/number/enum/uint8.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"uint8.mjs","sources":["../../../src/number/enum/uint8.mts"],"sourcesContent":["import { type Uint8 as TtfImported_Uint8, type Uint16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Uint8 = TtfImported_Uint8;\n\nconst typeNameInMessage = 'an non-negative integer less than 256';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n castType: castTypeImpl,\n clamp: clampImpl,\n is: isImpl,\n random: randomImpl,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<Uint16, 0, 255>(\n {\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 0,\n MAX_VALUE: 255,\n typeNameInMessage,\n } as const,\n);\n\nconst is = (x: number): x is Uint8 => isImpl(x);\n\nconst castType = (x: number): Uint8 =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n castTypeImpl(x) as Uint8;\n\nconst clamp = (a: number): Uint8 => castType(clampImpl(a));\n\nconst min_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.min(...values));\n\nconst max_ = (...values: readonly Uint8[]): Uint8 =>\n castType(Math.max(...values));\n\nconst pow = (x: Uint8, y: Uint8): Uint8 => clamp(x ** y);\n\nconst add = (x: Uint8, y: Uint8): Uint8 => clamp(x + y);\n\nconst sub = (x: Uint8, y: Uint8): Uint8 => clamp(x - y);\n\nconst mul = (x: Uint8, y: Uint8): Uint8 => clamp(x * y);\n\nconst div = (x: Uint8, y: Exclude<Uint8, 0>): Uint8 => clamp(Math.floor(x / y));\n\nconst random = (min: Uint8, max: Uint8): Uint8 =>\n castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));\n\n/**\n * Checks if a number is a Uint8 (8-bit unsigned integer in the range [0, 255]).\n *\n * @param value The value to check.\n * @returns `true` if the value is a Uint8, `false` otherwise.\n */\nexport const isUint8 = is;\n\n/**\n * Casts a number to a Uint8 type. This function validates that the input is\n * within the Uint8 range [0, 255] and is an integer, then returns it with the\n * Uint8 brand.\n *\n * @param value The value to cast.\n * @returns The value as a Uint8 type.\n * @throws {TypeError} If the value is not a valid 8-bit unsigned integer.\n */\nexport const asUint8 = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for 8-bit unsigned\n * integers.\n *\n * All operations automatically clamp results to the valid Uint8 range [0, 255].\n * This ensures that all arithmetic maintains the 8-bit unsigned integer\n * constraint, with negative results clamped to 0 and overflow results clamped\n * to MAX_VALUE.\n */\nexport const Uint8 = {\n /**\n * Type guard that checks if a value is an 8-bit unsigned integer.\n *\n * @param value The value to check.\n * @returns `true` if the value is an 8-bit unsigned integer, `false`\n * otherwise.\n */\n is,\n\n /**\n * The minimum value for an 8-bit unsigned integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for an 8-bit unsigned integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the larger of the given Uint8 values.\n *\n * @param values The Uint8 values to compare.\n * @returns The maximum value as a Uint8.\n */\n max: max_,\n\n /**\n * Returns the smaller of the given Uint8 values.\n *\n * @param values The Uint8 values to compare.\n * @returns The minimum value as a Uint8.\n */\n min: min_,\n\n /**\n * Clamps a number to the Uint8 range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [0, 255] as a Uint8.\n */\n clamp,\n\n /**\n * Generates a random Uint8 value within the specified range.\n *\n * @param min The minimum value (inclusive).\n * @param max The maximum value (inclusive).\n * @returns A random Uint8 between min and max.\n */\n random,\n\n /**\n * Raises x to the power of y, clamped to Uint8 range.\n *\n * @param x - The base\n * @param y - The exponent\n * @returns `x ** y` clamped to [0, 255]\n */\n pow,\n\n /**\n * Adds two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x + y` clamped to [0, 255]\n */\n add,\n\n /**\n * Subtracts two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x - y` clamped to [0, 255]\n */\n sub,\n\n /**\n * Multiplies two Uint8 values, clamped to Uint8 range.\n *\n * @param x - First operand\n * @param y - Second operand\n * @returns `x * y` clamped to [0, 255]\n */\n mul,\n\n /**\n * Divides two Uint8 values, clamped to Uint8 range.\n *\n * @param x - The dividend\n * @param y - The divisor (cannot be 0)\n * @returns `⌊x / y⌋` clamped to [0, 255]\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Uint8,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n Uint16,\n 'int' | 'non-negative' | 'range'\n >\n>('=');\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAA,GAAoB,uCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA,EAAO,SAAA;AAAA,EACP,EAAA,EAAI,MAAA;AAAA,EACJ,MAAA,EAAQ;AACV,CAAA,GAAI,qBAAqB,kBAAA,CAAmB,mBAAA;AAAA,EAC1C;AAAA,IACE,oBAAA,EAAsB,aAAA;AAAA,IACtB,SAAA,EAAW,CAAA;AAAA,IACX,SAAA,EAAW,GAAA;AAAA,IACX;AAAA;AAEJ,CAAA;AAEA,MAAM,EAAA,GAAK,CAAC,CAAA,KAA0B,MAAA,CAAO,CAAC,CAAA;AAE9C,MAAM,WAAW,CAAC,CAAA;AAAA;AAAA,EAEhB,aAAa,CAAC;AAAA,CAAA;AAEhB,MAAM,QAAQ,CAAC,CAAA,KAAqB,QAAA,CAAS,SAAA,CAAU,CAAC,CAAC,CAAA;AAEzD,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,IAAA,GAAO,IAAI,MAAA,KACf,QAAA,CAAS,KAAK,GAAA,CAAI,GAAG,MAAM,CAAC,CAAA;AAE9B,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,KAAK,CAAC,CAAA;AAEvD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,MAAM,CAAC,CAAA,EAAU,CAAA,KAAoB,KAAA,CAAM,IAAI,CAAC,CAAA;AAEtD,MAAM,GAAA,GAAM,CAAC,CAAA,EAAU,CAAA,KAAgC,MAAM,IAAA,CAAK,KAAA,CAAM,CAAA,GAAI,CAAC,CAAC,CAAA;AAE9E,MAAM,MAAA,GAAS,CAAC,GAAA,EAAY,GAAA,KAC1B,QAAA,CAAS,UAAA,CAAW,YAAA,CAAa,GAAG,CAAA,EAAG,YAAA,CAAa,GAAG,CAAC,CAAC,CAAA;AAQpD,MAAM,OAAA,GAAU;AAWhB,MAAM,OAAA,GAAU;AAWhB,MAAM,KAAA,GAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA;AACF;;;;"}
|
package/dist/number/num.d.mts
CHANGED
|
@@ -449,7 +449,7 @@ export declare namespace Num {
|
|
|
449
449
|
* @returns `a / b`, typed as the tightest branded type guaranteed to contain
|
|
450
450
|
* it.
|
|
451
451
|
*/
|
|
452
|
-
export const div: <A extends number, B extends NonZeroNumber | SmallInt<
|
|
452
|
+
export const div: <A extends number, B extends NonZeroNumber | SmallInt<'!=0'>>(a: A, b: B) => DivResult<A, B>;
|
|
453
453
|
/**
|
|
454
454
|
* Performs integer division using floor division.
|
|
455
455
|
*
|
|
@@ -463,7 +463,7 @@ export declare namespace Num {
|
|
|
463
463
|
* @param b - The divisor
|
|
464
464
|
* @returns The integer quotient, or `NaN` if b is zero
|
|
465
465
|
*/
|
|
466
|
-
export const divInt: <A extends number, B extends NonZeroNumber | SmallInt<
|
|
466
|
+
export const divInt: <A extends number, B extends NonZeroNumber | SmallInt<'!=0'>>(a: A, b: B) => DivIntResult<A, B>;
|
|
467
467
|
/**
|
|
468
468
|
* Rounds a number to a specified number of decimal places.
|
|
469
469
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"num.d.mts","sourceRoot":"","sources":["../../src/number/num.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;GAcG;AACH,yBAAiB,GAAG,CAAC;IACnB;;;;;;;;;;;;;;;OAeG;IACH,MA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