ts-data-forge 8.0.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.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 +1 -1
- 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.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +18 -169
- package/dist/array/impl/array-utils-validation.mjs.map +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 +1 -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/functional/ternary-result/ternary-result.d.mts.map +1 -1
- 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 +1 -0
- package/dist/guard/index.d.mts.map +1 -1
- package/dist/guard/index.mjs +1 -0
- package/dist/guard/index.mjs.map +1 -1
- package/dist/guard/is-length-bounded-string.d.mts +164 -0
- package/dist/guard/is-length-bounded-string.d.mts.map +1 -0
- package/dist/guard/is-length-bounded-string.mjs +7 -0
- package/dist/guard/is-length-bounded-string.mjs.map +1 -0
- 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 +1 -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 +17 -16
- package/src/array/impl/array-utils-transformation.mts +1 -2
- package/src/array/impl/array-utils-transformation.test.mts +3 -36
- package/src/array/impl/array-utils-validation.test.mts +1 -3
- package/src/expect-type.mts +4 -5
- package/src/functional/ternary-result/ternary-result.mts +2 -6
- package/src/guard/index.mts +1 -0
- package/src/guard/is-length-bounded-string.mts +199 -0
- package/src/guard/is-length-bounded-string.test.mts +170 -0
- package/src/number/refined-number-utils.mts +1 -9
- package/src/object/object.mts +25 -23
|
@@ -1,127 +1,118 @@
|
|
|
1
1
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
2
|
|
|
3
|
-
const typeNameInMessage =
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const typeNameInMessage = "a positive integer in [1, 2^15)";
|
|
4
|
+
const {
|
|
5
|
+
MAX_VALUE,
|
|
6
|
+
MIN_VALUE,
|
|
7
|
+
add,
|
|
8
|
+
castType,
|
|
9
|
+
clamp,
|
|
10
|
+
div,
|
|
11
|
+
is,
|
|
12
|
+
max: max_,
|
|
13
|
+
min: min_,
|
|
14
|
+
mul,
|
|
15
|
+
pow,
|
|
16
|
+
random,
|
|
17
|
+
sub
|
|
18
|
+
} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
19
|
+
integerOrSafeInteger: "SafeInteger",
|
|
20
|
+
MIN_VALUE: 1,
|
|
21
|
+
MAX_VALUE: 2 ** 15 - 1,
|
|
22
|
+
typeNameInMessage
|
|
9
23
|
});
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a number is a PositiveInt16 (16-bit positive signed integer in the
|
|
12
|
-
* range [1, 2^15)).
|
|
13
|
-
*
|
|
14
|
-
* @param value The value to check.
|
|
15
|
-
* @returns `true` if the value is a PositiveInt16, `false` otherwise.
|
|
16
|
-
*/
|
|
17
24
|
const isPositiveInt16 = is;
|
|
18
|
-
/**
|
|
19
|
-
* Casts a number to a PositiveInt16 type.
|
|
20
|
-
*
|
|
21
|
-
* @param value The value to cast.
|
|
22
|
-
* @returns The value as a PositiveInt16 type.
|
|
23
|
-
* @throws {TypeError} If the value is not a positive integer in [1, 2^15).
|
|
24
|
-
*/
|
|
25
25
|
const asPositiveInt16 = castType;
|
|
26
|
-
/**
|
|
27
|
-
* Namespace providing type-safe arithmetic operations for 16-bit positive
|
|
28
|
-
* integers.
|
|
29
|
-
*
|
|
30
|
-
* All operations automatically clamp results to the valid PositiveInt16 range
|
|
31
|
-
* [1, 32767]. This ensures that all arithmetic maintains the 16-bit positive
|
|
32
|
-
* integer constraint, with results below 1 clamped to MIN_VALUE and overflow
|
|
33
|
-
* results clamped to MAX_VALUE.
|
|
34
|
-
*/
|
|
35
26
|
const PositiveInt16 = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if a value is a PositiveInt16.
|
|
29
|
+
*
|
|
30
|
+
* @param value The value to check.
|
|
31
|
+
* @returns `true` if the value is a 16-bit positive integer, `false`
|
|
32
|
+
* otherwise.
|
|
33
|
+
*/
|
|
34
|
+
is,
|
|
35
|
+
/**
|
|
36
|
+
* The minimum value for a 16-bit positive integer.
|
|
37
|
+
*
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
MIN_VALUE,
|
|
41
|
+
/**
|
|
42
|
+
* The maximum value for a 16-bit positive integer.
|
|
43
|
+
*
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
MAX_VALUE,
|
|
47
|
+
/**
|
|
48
|
+
* Returns the smaller of two PositiveInt16 values.
|
|
49
|
+
*
|
|
50
|
+
* @param a The first PositiveInt16.
|
|
51
|
+
* @param b The second PositiveInt16.
|
|
52
|
+
* @returns The minimum value as a PositiveInt16.
|
|
53
|
+
*/
|
|
54
|
+
min: min_,
|
|
55
|
+
/**
|
|
56
|
+
* Returns the larger of two PositiveInt16 values.
|
|
57
|
+
*
|
|
58
|
+
* @param a The first PositiveInt16.
|
|
59
|
+
* @param b The second PositiveInt16.
|
|
60
|
+
* @returns The maximum value as a PositiveInt16.
|
|
61
|
+
*/
|
|
62
|
+
max: max_,
|
|
63
|
+
/**
|
|
64
|
+
* Clamps a number to the PositiveInt16 range.
|
|
65
|
+
*
|
|
66
|
+
* @param value The number to clamp.
|
|
67
|
+
* @returns The value clamped to [1, 32767] as a PositiveInt16.
|
|
68
|
+
*/
|
|
69
|
+
clamp,
|
|
70
|
+
/**
|
|
71
|
+
* Generates a random PositiveInt16 value within the valid range.
|
|
72
|
+
*
|
|
73
|
+
* @returns A random PositiveInt16 between 1 and 32767.
|
|
74
|
+
*/
|
|
75
|
+
random,
|
|
76
|
+
/**
|
|
77
|
+
* Raises a PositiveInt16 to the power of another PositiveInt16.
|
|
78
|
+
*
|
|
79
|
+
* @param a The base PositiveInt16.
|
|
80
|
+
* @param b The exponent PositiveInt16.
|
|
81
|
+
* @returns `a ** b` clamped to [1, 32767] as a PositiveInt16.
|
|
82
|
+
*/
|
|
83
|
+
pow,
|
|
84
|
+
/**
|
|
85
|
+
* Adds two PositiveInt16 values.
|
|
86
|
+
*
|
|
87
|
+
* @param a The first PositiveInt16.
|
|
88
|
+
* @param b The second PositiveInt16.
|
|
89
|
+
* @returns `a + b` clamped to [1, 32767] as a PositiveInt16.
|
|
90
|
+
*/
|
|
91
|
+
add,
|
|
92
|
+
/**
|
|
93
|
+
* Subtracts one PositiveInt16 from another.
|
|
94
|
+
*
|
|
95
|
+
* @param a The minuend PositiveInt16.
|
|
96
|
+
* @param b The subtrahend PositiveInt16.
|
|
97
|
+
* @returns `a - b` clamped to [1, 32767] as a PositiveInt16 (minimum 1).
|
|
98
|
+
*/
|
|
99
|
+
sub,
|
|
100
|
+
/**
|
|
101
|
+
* Multiplies two PositiveInt16 values.
|
|
102
|
+
*
|
|
103
|
+
* @param a The first PositiveInt16.
|
|
104
|
+
* @param b The second PositiveInt16.
|
|
105
|
+
* @returns `a * b` clamped to [1, 32767] as a PositiveInt16.
|
|
106
|
+
*/
|
|
107
|
+
mul,
|
|
108
|
+
/**
|
|
109
|
+
* Divides one PositiveInt16 by another using floor division.
|
|
110
|
+
*
|
|
111
|
+
* @param a The dividend PositiveInt16.
|
|
112
|
+
* @param b The divisor PositiveInt16.
|
|
113
|
+
* @returns `⌊a / b⌋` clamped to [1, 32767] as a PositiveInt16.
|
|
114
|
+
*/
|
|
115
|
+
div
|
|
125
116
|
};
|
|
126
117
|
|
|
127
118
|
export { PositiveInt16, asPositiveInt16, isPositiveInt16 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int16.mjs","sources":["../../../src/number/branded-types/positive-int16.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"positive-int16.mjs","sources":["../../../src/number/branded-types/positive-int16.mts"],"sourcesContent":["import { type PositiveInt16 as TtfImported_PositiveInt16 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt16 = TtfImported_PositiveInt16;\n\ntype ElementType = PositiveInt16;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^15)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 15 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Checks if a number is a PositiveInt16 (16-bit positive signed integer in the\n * range [1, 2^15)).\n *\n * @param value The value to check.\n * @returns `true` if the value is a PositiveInt16, `false` otherwise.\n */\nexport const isPositiveInt16 = is;\n\n/**\n * Casts a number to a PositiveInt16 type.\n *\n * @param value The value to cast.\n * @returns The value as a PositiveInt16 type.\n * @throws {TypeError} If the value is not a positive integer in [1, 2^15).\n */\nexport const asPositiveInt16 = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for 16-bit positive\n * integers.\n *\n * All operations automatically clamp results to the valid PositiveInt16 range\n * [1, 32767]. This ensures that all arithmetic maintains the 16-bit positive\n * integer constraint, with results below 1 clamped to MIN_VALUE and overflow\n * results clamped to MAX_VALUE.\n */\nexport const PositiveInt16 = {\n /**\n * Type guard to check if a value is a PositiveInt16.\n *\n * @param value The value to check.\n * @returns `true` if the value is a 16-bit positive integer, `false`\n * otherwise.\n */\n is,\n\n /**\n * The minimum value for a 16-bit positive integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for a 16-bit positive integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the smaller of two PositiveInt16 values.\n *\n * @param a The first PositiveInt16.\n * @param b The second PositiveInt16.\n * @returns The minimum value as a PositiveInt16.\n */\n min: min_,\n\n /**\n * Returns the larger of two PositiveInt16 values.\n *\n * @param a The first PositiveInt16.\n * @param b The second PositiveInt16.\n * @returns The maximum value as a PositiveInt16.\n */\n max: max_,\n\n /**\n * Clamps a number to the PositiveInt16 range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [1, 32767] as a PositiveInt16.\n */\n clamp,\n\n /**\n * Generates a random PositiveInt16 value within the valid range.\n *\n * @returns A random PositiveInt16 between 1 and 32767.\n */\n random,\n\n /**\n * Raises a PositiveInt16 to the power of another PositiveInt16.\n *\n * @param a The base PositiveInt16.\n * @param b The exponent PositiveInt16.\n * @returns `a ** b` clamped to [1, 32767] as a PositiveInt16.\n */\n pow,\n\n /**\n * Adds two PositiveInt16 values.\n *\n * @param a The first PositiveInt16.\n * @param b The second PositiveInt16.\n * @returns `a + b` clamped to [1, 32767] as a PositiveInt16.\n */\n add,\n\n /**\n * Subtracts one PositiveInt16 from another.\n *\n * @param a The minuend PositiveInt16.\n * @param b The subtrahend PositiveInt16.\n * @returns `a - b` clamped to [1, 32767] as a PositiveInt16 (minimum 1).\n */\n sub,\n\n /**\n * Multiplies two PositiveInt16 values.\n *\n * @param a The first PositiveInt16.\n * @param b The second PositiveInt16.\n * @returns `a * b` clamped to [1, 32767] as a PositiveInt16.\n */\n mul,\n\n /**\n * Divides one PositiveInt16 by another using floor division.\n *\n * @param a The dividend PositiveInt16.\n * @param b The divisor PositiveInt16.\n * @returns `⌊a / b⌋` clamped to [1, 32767] as a PositiveInt16.\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt16,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt16,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AASH,MAAM,eAAA,GAAkB;AASxB,MAAM,eAAA,GAAkB;AAWxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,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;;;;"}
|
|
@@ -16,18 +16,18 @@ export declare const isPositiveInt32: (a: number) => a is TtfImported_PositiveIn
|
|
|
16
16
|
* @throws {TypeError} If the value is not a positive integer in [1, 2^31).
|
|
17
17
|
*/
|
|
18
18
|
export declare const asPositiveInt32: <N extends number>(x: N) => number & {
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
19
|
+
readonly "!=0": true;
|
|
20
|
+
readonly "< 2^31": true;
|
|
21
|
+
readonly "< 2^32": true;
|
|
22
|
+
readonly "<=0": false;
|
|
22
23
|
readonly "> -2^16": true;
|
|
23
24
|
readonly "> -2^32": true;
|
|
24
25
|
readonly ">= -2^15": true;
|
|
25
26
|
readonly ">= -2^31": true;
|
|
26
27
|
readonly ">=0": true;
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly "< 2^32": true;
|
|
28
|
+
readonly Finite: true;
|
|
29
|
+
readonly Int: true;
|
|
30
|
+
readonly NaNValue: false;
|
|
31
31
|
readonly SafeInt: true;
|
|
32
32
|
} & Readonly<{
|
|
33
33
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
@@ -130,19 +130,19 @@ export declare const PositiveInt32: {
|
|
|
130
130
|
* @param b The divisor PositiveInt32.
|
|
131
131
|
* @returns `⌊a / b⌋` clamped to [1, 2147483647] as a PositiveInt32.
|
|
132
132
|
*/
|
|
133
|
-
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_PositiveInt32>, y: 1 | 2 | 3 |
|
|
134
|
-
readonly
|
|
135
|
-
readonly
|
|
136
|
-
readonly
|
|
133
|
+
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_PositiveInt32>, y: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | import("ts-type-forge").NormalizeBrandUnion<number & {
|
|
134
|
+
readonly "!=0": true;
|
|
135
|
+
readonly "< 2^31": true;
|
|
136
|
+
readonly "< 2^32": true;
|
|
137
|
+
readonly "<=0": false;
|
|
137
138
|
readonly "> -2^16": true;
|
|
138
139
|
readonly "> -2^32": true;
|
|
139
140
|
readonly ">= -2^15": true;
|
|
140
141
|
readonly ">= -2^31": true;
|
|
141
142
|
readonly ">=0": true;
|
|
142
|
-
readonly
|
|
143
|
-
readonly
|
|
144
|
-
readonly
|
|
145
|
-
readonly "< 2^32": true;
|
|
143
|
+
readonly Finite: true;
|
|
144
|
+
readonly Int: true;
|
|
145
|
+
readonly NaNValue: false;
|
|
146
146
|
readonly SafeInt: true;
|
|
147
147
|
} & Readonly<{
|
|
148
148
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
@@ -1,127 +1,118 @@
|
|
|
1
1
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
2
|
|
|
3
|
-
const typeNameInMessage =
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const typeNameInMessage = "a positive integer in [1, 2^31)";
|
|
4
|
+
const {
|
|
5
|
+
MAX_VALUE,
|
|
6
|
+
MIN_VALUE,
|
|
7
|
+
add,
|
|
8
|
+
castType,
|
|
9
|
+
clamp,
|
|
10
|
+
div,
|
|
11
|
+
is,
|
|
12
|
+
max: max_,
|
|
13
|
+
min: min_,
|
|
14
|
+
mul,
|
|
15
|
+
pow,
|
|
16
|
+
random,
|
|
17
|
+
sub
|
|
18
|
+
} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
19
|
+
integerOrSafeInteger: "SafeInteger",
|
|
20
|
+
MIN_VALUE: 1,
|
|
21
|
+
MAX_VALUE: 2 ** 31 - 1,
|
|
22
|
+
typeNameInMessage
|
|
9
23
|
});
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a number is a PositiveInt32 (32-bit positive signed integer in the
|
|
12
|
-
* range [1, 2^31)).
|
|
13
|
-
*
|
|
14
|
-
* @param value The value to check.
|
|
15
|
-
* @returns `true` if the value is a PositiveInt32, `false` otherwise.
|
|
16
|
-
*/
|
|
17
24
|
const isPositiveInt32 = is;
|
|
18
|
-
/**
|
|
19
|
-
* Casts a number to a PositiveInt32 type.
|
|
20
|
-
*
|
|
21
|
-
* @param value The value to cast.
|
|
22
|
-
* @returns The value as a PositiveInt32 type.
|
|
23
|
-
* @throws {TypeError} If the value is not a positive integer in [1, 2^31).
|
|
24
|
-
*/
|
|
25
25
|
const asPositiveInt32 = castType;
|
|
26
|
-
/**
|
|
27
|
-
* Namespace providing type-safe arithmetic operations for 32-bit positive
|
|
28
|
-
* integers.
|
|
29
|
-
*
|
|
30
|
-
* All operations automatically clamp results to the valid PositiveInt32 range
|
|
31
|
-
* [1, 2147483647]. This ensures that all arithmetic maintains the 32-bit
|
|
32
|
-
* positive integer constraint, with results below 1 clamped to MIN_VALUE and
|
|
33
|
-
* overflow results clamped to MAX_VALUE.
|
|
34
|
-
*/
|
|
35
26
|
const PositiveInt32 = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if a value is a PositiveInt32.
|
|
29
|
+
*
|
|
30
|
+
* @param value The value to check.
|
|
31
|
+
* @returns `true` if the value is a 32-bit positive integer, `false`
|
|
32
|
+
* otherwise.
|
|
33
|
+
*/
|
|
34
|
+
is,
|
|
35
|
+
/**
|
|
36
|
+
* The minimum value for a 32-bit positive integer.
|
|
37
|
+
*
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
MIN_VALUE,
|
|
41
|
+
/**
|
|
42
|
+
* The maximum value for a 32-bit positive integer.
|
|
43
|
+
*
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
MAX_VALUE,
|
|
47
|
+
/**
|
|
48
|
+
* Returns the smaller of two PositiveInt32 values.
|
|
49
|
+
*
|
|
50
|
+
* @param a The first PositiveInt32.
|
|
51
|
+
* @param b The second PositiveInt32.
|
|
52
|
+
* @returns The minimum value as a PositiveInt32.
|
|
53
|
+
*/
|
|
54
|
+
min: min_,
|
|
55
|
+
/**
|
|
56
|
+
* Returns the larger of two PositiveInt32 values.
|
|
57
|
+
*
|
|
58
|
+
* @param a The first PositiveInt32.
|
|
59
|
+
* @param b The second PositiveInt32.
|
|
60
|
+
* @returns The maximum value as a PositiveInt32.
|
|
61
|
+
*/
|
|
62
|
+
max: max_,
|
|
63
|
+
/**
|
|
64
|
+
* Clamps a number to the PositiveInt32 range.
|
|
65
|
+
*
|
|
66
|
+
* @param value The number to clamp.
|
|
67
|
+
* @returns The value clamped to [1, 2147483647] as a PositiveInt32.
|
|
68
|
+
*/
|
|
69
|
+
clamp,
|
|
70
|
+
/**
|
|
71
|
+
* Generates a random PositiveInt32 value within the valid range.
|
|
72
|
+
*
|
|
73
|
+
* @returns A random PositiveInt32 between 1 and 2147483647.
|
|
74
|
+
*/
|
|
75
|
+
random,
|
|
76
|
+
/**
|
|
77
|
+
* Raises a PositiveInt32 to the power of another PositiveInt32.
|
|
78
|
+
*
|
|
79
|
+
* @param a The base PositiveInt32.
|
|
80
|
+
* @param b The exponent PositiveInt32.
|
|
81
|
+
* @returns `a ** b` clamped to [1, 2147483647] as a PositiveInt32.
|
|
82
|
+
*/
|
|
83
|
+
pow,
|
|
84
|
+
/**
|
|
85
|
+
* Adds two PositiveInt32 values.
|
|
86
|
+
*
|
|
87
|
+
* @param a The first PositiveInt32.
|
|
88
|
+
* @param b The second PositiveInt32.
|
|
89
|
+
* @returns `a + b` clamped to [1, 2147483647] as a PositiveInt32.
|
|
90
|
+
*/
|
|
91
|
+
add,
|
|
92
|
+
/**
|
|
93
|
+
* Subtracts one PositiveInt32 from another.
|
|
94
|
+
*
|
|
95
|
+
* @param a The minuend PositiveInt32.
|
|
96
|
+
* @param b The subtrahend PositiveInt32.
|
|
97
|
+
* @returns `a - b` clamped to [1, 2147483647] as a PositiveInt32 (minimum 1).
|
|
98
|
+
*/
|
|
99
|
+
sub,
|
|
100
|
+
/**
|
|
101
|
+
* Multiplies two PositiveInt32 values.
|
|
102
|
+
*
|
|
103
|
+
* @param a The first PositiveInt32.
|
|
104
|
+
* @param b The second PositiveInt32.
|
|
105
|
+
* @returns `a * b` clamped to [1, 2147483647] as a PositiveInt32.
|
|
106
|
+
*/
|
|
107
|
+
mul,
|
|
108
|
+
/**
|
|
109
|
+
* Divides one PositiveInt32 by another using floor division.
|
|
110
|
+
*
|
|
111
|
+
* @param a The dividend PositiveInt32.
|
|
112
|
+
* @param b The divisor PositiveInt32.
|
|
113
|
+
* @returns `⌊a / b⌋` clamped to [1, 2147483647] as a PositiveInt32.
|
|
114
|
+
*/
|
|
115
|
+
div
|
|
125
116
|
};
|
|
126
117
|
|
|
127
118
|
export { PositiveInt32, asPositiveInt32, isPositiveInt32 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int32.mjs","sources":["../../../src/number/branded-types/positive-int32.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"positive-int32.mjs","sources":["../../../src/number/branded-types/positive-int32.mts"],"sourcesContent":["import { type PositiveInt32 as TtfImported_PositiveInt32 } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type PositiveInt32 = TtfImported_PositiveInt32;\n\ntype ElementType = PositiveInt32;\n\nconst typeNameInMessage = 'a positive integer in [1, 2^31)';\n\nconst {\n MAX_VALUE,\n MIN_VALUE,\n add,\n castType,\n clamp,\n div,\n is,\n max: max_,\n min: min_,\n mul,\n pow,\n random,\n sub,\n} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger<\n ElementType,\n 1,\n number\n>({\n integerOrSafeInteger: 'SafeInteger',\n MIN_VALUE: 1,\n MAX_VALUE: 2 ** 31 - 1,\n typeNameInMessage,\n} as const);\n\n/**\n * Checks if a number is a PositiveInt32 (32-bit positive signed integer in the\n * range [1, 2^31)).\n *\n * @param value The value to check.\n * @returns `true` if the value is a PositiveInt32, `false` otherwise.\n */\nexport const isPositiveInt32 = is;\n\n/**\n * Casts a number to a PositiveInt32 type.\n *\n * @param value The value to cast.\n * @returns The value as a PositiveInt32 type.\n * @throws {TypeError} If the value is not a positive integer in [1, 2^31).\n */\nexport const asPositiveInt32 = castType;\n\n/**\n * Namespace providing type-safe arithmetic operations for 32-bit positive\n * integers.\n *\n * All operations automatically clamp results to the valid PositiveInt32 range\n * [1, 2147483647]. This ensures that all arithmetic maintains the 32-bit\n * positive integer constraint, with results below 1 clamped to MIN_VALUE and\n * overflow results clamped to MAX_VALUE.\n */\nexport const PositiveInt32 = {\n /**\n * Type guard to check if a value is a PositiveInt32.\n *\n * @param value The value to check.\n * @returns `true` if the value is a 32-bit positive integer, `false`\n * otherwise.\n */\n is,\n\n /**\n * The minimum value for a 32-bit positive integer.\n *\n * @readonly\n */\n MIN_VALUE,\n\n /**\n * The maximum value for a 32-bit positive integer.\n *\n * @readonly\n */\n MAX_VALUE,\n\n /**\n * Returns the smaller of two PositiveInt32 values.\n *\n * @param a The first PositiveInt32.\n * @param b The second PositiveInt32.\n * @returns The minimum value as a PositiveInt32.\n */\n min: min_,\n\n /**\n * Returns the larger of two PositiveInt32 values.\n *\n * @param a The first PositiveInt32.\n * @param b The second PositiveInt32.\n * @returns The maximum value as a PositiveInt32.\n */\n max: max_,\n\n /**\n * Clamps a number to the PositiveInt32 range.\n *\n * @param value The number to clamp.\n * @returns The value clamped to [1, 2147483647] as a PositiveInt32.\n */\n clamp,\n\n /**\n * Generates a random PositiveInt32 value within the valid range.\n *\n * @returns A random PositiveInt32 between 1 and 2147483647.\n */\n random,\n\n /**\n * Raises a PositiveInt32 to the power of another PositiveInt32.\n *\n * @param a The base PositiveInt32.\n * @param b The exponent PositiveInt32.\n * @returns `a ** b` clamped to [1, 2147483647] as a PositiveInt32.\n */\n pow,\n\n /**\n * Adds two PositiveInt32 values.\n *\n * @param a The first PositiveInt32.\n * @param b The second PositiveInt32.\n * @returns `a + b` clamped to [1, 2147483647] as a PositiveInt32.\n */\n add,\n\n /**\n * Subtracts one PositiveInt32 from another.\n *\n * @param a The minuend PositiveInt32.\n * @param b The subtrahend PositiveInt32.\n * @returns `a - b` clamped to [1, 2147483647] as a PositiveInt32 (minimum 1).\n */\n sub,\n\n /**\n * Multiplies two PositiveInt32 values.\n *\n * @param a The first PositiveInt32.\n * @param b The second PositiveInt32.\n * @returns `a * b` clamped to [1, 2147483647] as a PositiveInt32.\n */\n mul,\n\n /**\n * Divides one PositiveInt32 by another using floor division.\n *\n * @param a The dividend PositiveInt32.\n * @param b The divisor PositiveInt32.\n * @returns `⌊a / b⌋` clamped to [1, 2147483647] as a PositiveInt32.\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof PositiveInt32,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('=');\n\nexpectType<\n typeof PositiveInt32,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<\n ElementType,\n 'int' | 'positive' | 'range'\n >\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,iCAAA;AAE1B,MAAM;AAAA,EACJ,SAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAA,EAAK,IAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,GAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,GAAI,oBAAA,CAAqB,mBAAmB,mBAAA,CAI1C;AAAA,EACA,oBAAA,EAAsB,aAAA;AAAA,EACtB,SAAA,EAAW,CAAA;AAAA,EACX,SAAA,EAAW,KAAK,EAAA,GAAK,CAAA;AAAA,EACrB;AACF,CAAU,CAAA;AASH,MAAM,eAAA,GAAkB;AASxB,MAAM,eAAA,GAAkB;AAWxB,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,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;;;;"}
|
|
@@ -38,16 +38,16 @@ export declare const isPositiveSafeInt: (a: number) => a is TtfImported_Positive
|
|
|
38
38
|
* @throws {TypeError} If the value is not a positive safe integer.
|
|
39
39
|
*/
|
|
40
40
|
export declare const asPositiveSafeInt: <N extends number>(x: N) => number & {
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly Int: true;
|
|
41
|
+
readonly "!=0": true;
|
|
42
|
+
readonly "<=0": false;
|
|
44
43
|
readonly "> -2^16": true;
|
|
45
44
|
readonly "> -2^32": true;
|
|
46
45
|
readonly ">= -2^15": true;
|
|
47
46
|
readonly ">= -2^31": true;
|
|
48
47
|
readonly ">=0": true;
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
48
|
+
readonly Finite: true;
|
|
49
|
+
readonly Int: true;
|
|
50
|
+
readonly NaNValue: false;
|
|
51
51
|
readonly SafeInt: true;
|
|
52
52
|
} & Readonly<{
|
|
53
53
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
@@ -284,17 +284,17 @@ export declare const PositiveSafeInt: {
|
|
|
284
284
|
* @param b The divisor PositiveSafeInt.
|
|
285
285
|
* @returns `⌊a / b⌋` clamped to [1, MAX_SAFE_INTEGER] as a PositiveSafeInt.
|
|
286
286
|
*/
|
|
287
|
-
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_PositiveSafeInt>, y: 1 | 2 | 3 |
|
|
288
|
-
readonly
|
|
289
|
-
readonly
|
|
290
|
-
readonly Int: true;
|
|
287
|
+
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_PositiveSafeInt>, y: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | import("ts-type-forge").NormalizeBrandUnion<number & {
|
|
288
|
+
readonly "!=0": true;
|
|
289
|
+
readonly "<=0": false;
|
|
291
290
|
readonly "> -2^16": true;
|
|
292
291
|
readonly "> -2^32": true;
|
|
293
292
|
readonly ">= -2^15": true;
|
|
294
293
|
readonly ">= -2^31": true;
|
|
295
294
|
readonly ">=0": true;
|
|
296
|
-
readonly
|
|
297
|
-
readonly
|
|
295
|
+
readonly Finite: true;
|
|
296
|
+
readonly Int: true;
|
|
297
|
+
readonly NaNValue: false;
|
|
298
298
|
readonly SafeInt: true;
|
|
299
299
|
} & Readonly<{
|
|
300
300
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|