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,254 +1,214 @@
|
|
|
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";
|
|
4
|
+
const {
|
|
5
|
+
abs,
|
|
6
|
+
add,
|
|
7
|
+
castType,
|
|
8
|
+
div,
|
|
9
|
+
is,
|
|
10
|
+
max: max_,
|
|
11
|
+
min: min_,
|
|
12
|
+
mul,
|
|
13
|
+
pow,
|
|
14
|
+
random,
|
|
15
|
+
sub
|
|
16
|
+
} = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
17
|
+
integerOrSafeInteger: "Integer",
|
|
18
|
+
MIN_VALUE: -Number.MAX_VALUE,
|
|
19
|
+
MAX_VALUE: Number.MAX_VALUE,
|
|
20
|
+
typeNameInMessage
|
|
9
21
|
});
|
|
10
|
-
/**
|
|
11
|
-
* Type guard that checks if a value is an integer.
|
|
12
|
-
*
|
|
13
|
-
* Returns `true` if the value is any integer (positive, negative, or zero),
|
|
14
|
-
* with no fractional component. This includes values outside the safe integer
|
|
15
|
-
* range, unlike SafeInt.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```ts
|
|
20
|
-
* assert.isTrue(isInt(5));
|
|
21
|
-
*
|
|
22
|
-
* assert.isFalse(isInt(5.25));
|
|
23
|
-
*
|
|
24
|
-
* assert.isTrue(Int.is(-10));
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @param value - The value to check
|
|
28
|
-
* @returns `true` if the value is an integer, `false` otherwise
|
|
29
|
-
*/
|
|
30
22
|
const isInt = is;
|
|
31
|
-
/**
|
|
32
|
-
* Casts a number to an Int branded type.
|
|
33
|
-
*
|
|
34
|
-
* This function validates that the input is an integer and returns it with the
|
|
35
|
-
* Int brand. Throws a TypeError if the value has a fractional component or is
|
|
36
|
-
* not a finite number.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* const branded = asInt(42);
|
|
42
|
-
*
|
|
43
|
-
* assert.isTrue(branded === 42);
|
|
44
|
-
*
|
|
45
|
-
* assert.isTrue(Int.is(branded));
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @param value - The value to cast
|
|
49
|
-
* @returns The value as an Int branded type
|
|
50
|
-
* @throws {TypeError} If the value is not an integer
|
|
51
|
-
*/
|
|
52
23
|
const asInt = castType;
|
|
53
|
-
/**
|
|
54
|
-
* Namespace providing type-safe operations for Int branded types.
|
|
55
|
-
*
|
|
56
|
-
* The Int type represents any integer value (no fractional component) without
|
|
57
|
-
* range restrictions. All operations preserve the integer constraint, using
|
|
58
|
-
* floor division for division operations.
|
|
59
|
-
*
|
|
60
|
-
* Unlike SafeInt, Int allows values outside the safe integer range (±2^53 - 1),
|
|
61
|
-
* but be aware that very large integers may lose precision in JavaScript's
|
|
62
|
-
* number type.
|
|
63
|
-
*/
|
|
64
24
|
const Int = {
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Type guard that checks if a value is an integer.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* assert.isTrue(isInt(5));
|
|
32
|
+
*
|
|
33
|
+
* assert.isFalse(isInt(5.25));
|
|
34
|
+
*
|
|
35
|
+
* assert.isTrue(Int.is(-10));
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param value - The value to check
|
|
39
|
+
* @returns `true` if the value is an integer, `false` otherwise
|
|
40
|
+
* @see {@link isInt} for usage examples
|
|
41
|
+
*/
|
|
42
|
+
is,
|
|
43
|
+
/**
|
|
44
|
+
* Returns the absolute value of an integer.
|
|
45
|
+
*
|
|
46
|
+
* The result is always non-negative and maintains the Int brand. Note that
|
|
47
|
+
* Math.abs(Number.MIN_SAFE_INTEGER) exceeds Number.MAX_SAFE_INTEGER, so use
|
|
48
|
+
* SafeInt for guaranteed precision.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* const negative = asInt(-12);
|
|
54
|
+
*
|
|
55
|
+
* const absolute = Int.abs(negative);
|
|
56
|
+
*
|
|
57
|
+
* assert.isTrue(absolute === 12);
|
|
58
|
+
*
|
|
59
|
+
* assert.isTrue(Int.is(absolute));
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param a - The integer value
|
|
63
|
+
* @returns The absolute value as a non-negative Int
|
|
64
|
+
*/
|
|
65
|
+
abs,
|
|
66
|
+
/**
|
|
67
|
+
* Returns the minimum value from a list of integers.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* const smallest = Int.min(asInt(7), asInt(-3), asInt(2));
|
|
73
|
+
*
|
|
74
|
+
* assert.isTrue(smallest === -3);
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param values - The integers to compare (at least one required)
|
|
78
|
+
* @returns The smallest value as an Int
|
|
79
|
+
*/
|
|
80
|
+
min: min_,
|
|
81
|
+
/**
|
|
82
|
+
* Returns the maximum value from a list of integers.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* const largest = Int.max(asInt(7), asInt(-3), asInt(2));
|
|
88
|
+
*
|
|
89
|
+
* assert.isTrue(largest === 7);
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param values - The integers to compare (at least one required)
|
|
93
|
+
* @returns The largest value as an Int
|
|
94
|
+
*/
|
|
95
|
+
max: max_,
|
|
96
|
+
/**
|
|
97
|
+
* Generates a random integer within the specified range (inclusive).
|
|
98
|
+
*
|
|
99
|
+
* The range is inclusive on both ends, so random(1, 6) can return any of: 1,
|
|
100
|
+
* 2, 3, 4, 5, or 6.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* const min = asInt(1);
|
|
106
|
+
*
|
|
107
|
+
* const max = asInt(6);
|
|
108
|
+
*
|
|
109
|
+
* const randomValue = Int.random(min, max);
|
|
110
|
+
*
|
|
111
|
+
* assert.isTrue(Int.is(randomValue));
|
|
112
|
+
*
|
|
113
|
+
* assert.isTrue(randomValue >= 1 && randomValue <= 6);
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param min - The minimum value (inclusive)
|
|
117
|
+
* @param max - The maximum value (inclusive)
|
|
118
|
+
* @returns A random Int in the range [min, max]
|
|
119
|
+
*/
|
|
120
|
+
random,
|
|
121
|
+
/**
|
|
122
|
+
* Raises an integer to a power.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* const base = asInt(2);
|
|
128
|
+
*
|
|
129
|
+
* const exponent = asInt(5);
|
|
130
|
+
*
|
|
131
|
+
* const power = Int.pow(base, exponent);
|
|
132
|
+
*
|
|
133
|
+
* assert.isTrue(power === 32);
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @param a - The base integer
|
|
137
|
+
* @param b - The exponent integer
|
|
138
|
+
* @returns `a ** b` as an Int
|
|
139
|
+
*/
|
|
140
|
+
pow,
|
|
141
|
+
/**
|
|
142
|
+
* Adds two integers.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* const sum = Int.add(asInt(12), asInt(8));
|
|
148
|
+
*
|
|
149
|
+
* assert.isTrue(sum === 20);
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @param a - First integer
|
|
153
|
+
* @param b - Second integer
|
|
154
|
+
* @returns `a + b` as an Int
|
|
155
|
+
*/
|
|
156
|
+
add,
|
|
157
|
+
/**
|
|
158
|
+
* Subtracts two integers.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* const difference = Int.sub(asInt(12), asInt(8));
|
|
164
|
+
*
|
|
165
|
+
* assert.isTrue(difference === 4);
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @param a - First integer
|
|
169
|
+
* @param b - Second integer
|
|
170
|
+
* @returns `a - b` as an Int
|
|
171
|
+
*/
|
|
172
|
+
sub,
|
|
173
|
+
/**
|
|
174
|
+
* Multiplies two integers.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
*
|
|
178
|
+
* ```ts
|
|
179
|
+
* const product = Int.mul(asInt(-4), asInt(6));
|
|
180
|
+
*
|
|
181
|
+
* assert.isTrue(product === -24);
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @param a - First integer
|
|
185
|
+
* @param b - Second integer
|
|
186
|
+
* @returns `a * b` as an Int
|
|
187
|
+
*/
|
|
188
|
+
mul,
|
|
189
|
+
/**
|
|
190
|
+
* Divides two integers using floor division.
|
|
191
|
+
*
|
|
192
|
+
* Performs mathematical floor division: `⌊a / b⌋`. The result is always an
|
|
193
|
+
* integer, rounding toward negative infinity.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* const dividend = asInt(17);
|
|
199
|
+
*
|
|
200
|
+
* const divisor = asInt(5);
|
|
201
|
+
*
|
|
202
|
+
* const quotient = Int.div(dividend, divisor);
|
|
203
|
+
*
|
|
204
|
+
* assert.isTrue(quotient === 3);
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @param a - The dividend
|
|
208
|
+
* @param b - The divisor (must be non-zero)
|
|
209
|
+
* @returns The integer quotient as an Int
|
|
210
|
+
*/
|
|
211
|
+
div
|
|
252
212
|
};
|
|
253
213
|
|
|
254
214
|
export { Int, asInt, isInt };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.mjs","sources":["../../../src/number/branded-types/int.mts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"int.mjs","sources":["../../../src/number/branded-types/int.mts"],"sourcesContent":["import { type Int as TtfImported_Int } from 'ts-type-forge';\nimport { expectType } from '../../expect-type.mjs';\nimport { TsDataForgeInternals } from '../refined-number-utils.mjs';\n\nexport type Int = TtfImported_Int;\n\ntype ElementType = Int;\n\nconst typeNameInMessage = 'an integer';\n\nconst {\n abs,\n add,\n castType,\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 number,\n number\n>({\n integerOrSafeInteger: 'Integer',\n MIN_VALUE: -Number.MAX_VALUE,\n MAX_VALUE: Number.MAX_VALUE,\n typeNameInMessage,\n} as const);\n\n/**\n * Type guard that checks if a value is an integer.\n *\n * Returns `true` if the value is any integer (positive, negative, or zero),\n * with no fractional component. This includes values outside the safe integer\n * range, unlike SafeInt.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isInt(5));\n *\n * assert.isFalse(isInt(5.25));\n *\n * assert.isTrue(Int.is(-10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer, `false` otherwise\n */\nexport const isInt = is;\n\n/**\n * Casts a number to an Int branded type.\n *\n * This function validates that the input is an integer and returns it with the\n * Int brand. Throws a TypeError if the value has a fractional component or is\n * not a finite number.\n *\n * @example\n *\n * ```ts\n * const branded = asInt(42);\n *\n * assert.isTrue(branded === 42);\n *\n * assert.isTrue(Int.is(branded));\n * ```\n *\n * @param value - The value to cast\n * @returns The value as an Int branded type\n * @throws {TypeError} If the value is not an integer\n */\nexport const asInt = castType;\n\n/**\n * Namespace providing type-safe operations for Int branded types.\n *\n * The Int type represents any integer value (no fractional component) without\n * range restrictions. All operations preserve the integer constraint, using\n * floor division for division operations.\n *\n * Unlike SafeInt, Int allows values outside the safe integer range (±2^53 - 1),\n * but be aware that very large integers may lose precision in JavaScript's\n * number type.\n */\nexport const Int = {\n /**\n * Type guard that checks if a value is an integer.\n *\n * @example\n *\n * ```ts\n * assert.isTrue(isInt(5));\n *\n * assert.isFalse(isInt(5.25));\n *\n * assert.isTrue(Int.is(-10));\n * ```\n *\n * @param value - The value to check\n * @returns `true` if the value is an integer, `false` otherwise\n * @see {@link isInt} for usage examples\n */\n is,\n\n /**\n * Returns the absolute value of an integer.\n *\n * The result is always non-negative and maintains the Int brand. Note that\n * Math.abs(Number.MIN_SAFE_INTEGER) exceeds Number.MAX_SAFE_INTEGER, so use\n * SafeInt for guaranteed precision.\n *\n * @example\n *\n * ```ts\n * const negative = asInt(-12);\n *\n * const absolute = Int.abs(negative);\n *\n * assert.isTrue(absolute === 12);\n *\n * assert.isTrue(Int.is(absolute));\n * ```\n *\n * @param a - The integer value\n * @returns The absolute value as a non-negative Int\n */\n abs,\n\n /**\n * Returns the minimum value from a list of integers.\n *\n * @example\n *\n * ```ts\n * const smallest = Int.min(asInt(7), asInt(-3), asInt(2));\n *\n * assert.isTrue(smallest === -3);\n * ```\n *\n * @param values - The integers to compare (at least one required)\n * @returns The smallest value as an Int\n */\n min: min_,\n\n /**\n * Returns the maximum value from a list of integers.\n *\n * @example\n *\n * ```ts\n * const largest = Int.max(asInt(7), asInt(-3), asInt(2));\n *\n * assert.isTrue(largest === 7);\n * ```\n *\n * @param values - The integers to compare (at least one required)\n * @returns The largest value as an Int\n */\n max: max_,\n\n /**\n * Generates a random integer within the specified range (inclusive).\n *\n * The range is inclusive on both ends, so random(1, 6) can return any of: 1,\n * 2, 3, 4, 5, or 6.\n *\n * @example\n *\n * ```ts\n * const min = asInt(1);\n *\n * const max = asInt(6);\n *\n * const randomValue = Int.random(min, max);\n *\n * assert.isTrue(Int.is(randomValue));\n *\n * assert.isTrue(randomValue >= 1 && randomValue <= 6);\n * ```\n *\n * @param min - The minimum value (inclusive)\n * @param max - The maximum value (inclusive)\n * @returns A random Int in the range [min, max]\n */\n random,\n\n /**\n * Raises an integer to a power.\n *\n * @example\n *\n * ```ts\n * const base = asInt(2);\n *\n * const exponent = asInt(5);\n *\n * const power = Int.pow(base, exponent);\n *\n * assert.isTrue(power === 32);\n * ```\n *\n * @param a - The base integer\n * @param b - The exponent integer\n * @returns `a ** b` as an Int\n */\n pow,\n\n /**\n * Adds two integers.\n *\n * @example\n *\n * ```ts\n * const sum = Int.add(asInt(12), asInt(8));\n *\n * assert.isTrue(sum === 20);\n * ```\n *\n * @param a - First integer\n * @param b - Second integer\n * @returns `a + b` as an Int\n */\n add,\n\n /**\n * Subtracts two integers.\n *\n * @example\n *\n * ```ts\n * const difference = Int.sub(asInt(12), asInt(8));\n *\n * assert.isTrue(difference === 4);\n * ```\n *\n * @param a - First integer\n * @param b - Second integer\n * @returns `a - b` as an Int\n */\n sub,\n\n /**\n * Multiplies two integers.\n *\n * @example\n *\n * ```ts\n * const product = Int.mul(asInt(-4), asInt(6));\n *\n * assert.isTrue(product === -24);\n * ```\n *\n * @param a - First integer\n * @param b - Second integer\n * @returns `a * b` as an Int\n */\n mul,\n\n /**\n * Divides two integers using floor division.\n *\n * Performs mathematical floor division: `⌊a / b⌋`. The result is always an\n * integer, rounding toward negative infinity.\n *\n * @example\n *\n * ```ts\n * const dividend = asInt(17);\n *\n * const divisor = asInt(5);\n *\n * const quotient = Int.div(dividend, divisor);\n *\n * assert.isTrue(quotient === 3);\n * ```\n *\n * @param a - The dividend\n * @param b - The divisor (must be non-zero)\n * @returns The integer quotient as an Int\n */\n div,\n} as const;\n\nexpectType<\n keyof typeof Int,\n keyof TsDataForgeInternals.RefinedNumberUtils.NumberClass<ElementType, 'int'>\n>('=');\n\nexpectType<\n typeof Int,\n TsDataForgeInternals.RefinedNumberUtils.NumberClass<ElementType, 'int'>\n>('<=');\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,GAAoB,YAAA;AAE1B,MAAM;AAAA,EACJ,GAAA;AAAA,EACA,GAAA;AAAA,EACA,QAAA;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,SAAA;AAAA,EACtB,SAAA,EAAW,CAAC,MAAA,CAAO,SAAA;AAAA,EACnB,WAAW,MAAA,CAAO,SAAA;AAAA,EAClB;AACF,CAAU,CAAA;AAsBH,MAAM,KAAA,GAAQ;AAuBd,MAAM,KAAA,GAAQ;AAad,MAAM,GAAA,GAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBjB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBL,GAAA,EAAK,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BL,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBA;AACF;;;;"}
|
|
@@ -16,17 +16,17 @@ export declare const isInt16: (a: number) => a is TtfImported_Int16;
|
|
|
16
16
|
* @throws {TypeError} If the value is not an integer in [-2^15, 2^15).
|
|
17
17
|
*/
|
|
18
18
|
export declare const asInt16: <N extends number>(x: N) => number & {
|
|
19
|
-
readonly NaNValue: false;
|
|
20
|
-
readonly Finite: true;
|
|
21
|
-
readonly Int: true;
|
|
22
|
-
readonly "> -2^16": true;
|
|
23
|
-
readonly "> -2^32": true;
|
|
24
|
-
readonly ">= -2^15": true;
|
|
25
|
-
readonly ">= -2^31": true;
|
|
26
19
|
readonly "< 2^15": true;
|
|
27
20
|
readonly "< 2^16": true;
|
|
28
21
|
readonly "< 2^31": true;
|
|
29
22
|
readonly "< 2^32": true;
|
|
23
|
+
readonly "> -2^16": true;
|
|
24
|
+
readonly "> -2^32": true;
|
|
25
|
+
readonly ">= -2^15": true;
|
|
26
|
+
readonly ">= -2^31": true;
|
|
27
|
+
readonly Finite: true;
|
|
28
|
+
readonly Int: true;
|
|
29
|
+
readonly NaNValue: false;
|
|
30
30
|
readonly SafeInt: true;
|
|
31
31
|
} & Readonly<{
|
|
32
32
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
@@ -134,19 +134,19 @@ export declare const Int16: {
|
|
|
134
134
|
* @param b The divisor Int16.
|
|
135
135
|
* @returns `⌊a / b⌋` clamped to [-32768, 32767] as an Int16.
|
|
136
136
|
*/
|
|
137
|
-
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int16>, y:
|
|
138
|
-
readonly NaNValue: false;
|
|
139
|
-
readonly Finite: true;
|
|
140
|
-
readonly Int: true;
|
|
141
|
-
readonly "> -2^16": true;
|
|
142
|
-
readonly "> -2^32": true;
|
|
143
|
-
readonly ">= -2^15": true;
|
|
144
|
-
readonly ">= -2^31": true;
|
|
137
|
+
readonly div: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int16>, y: -40 | -39 | -38 | -37 | -36 | -35 | -34 | -33 | -32 | -31 | -30 | -29 | -28 | -27 | -26 | -25 | -24 | -23 | -22 | -21 | -20 | -19 | -18 | -17 | -16 | -15 | -14 | -13 | -12 | -11 | -10 | -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 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 & {
|
|
145
138
|
readonly "!=0": true;
|
|
146
139
|
readonly "< 2^15": true;
|
|
147
140
|
readonly "< 2^16": true;
|
|
148
141
|
readonly "< 2^31": true;
|
|
149
142
|
readonly "< 2^32": true;
|
|
143
|
+
readonly "> -2^16": true;
|
|
144
|
+
readonly "> -2^32": true;
|
|
145
|
+
readonly ">= -2^15": true;
|
|
146
|
+
readonly ">= -2^31": true;
|
|
147
|
+
readonly Finite: true;
|
|
148
|
+
readonly Int: true;
|
|
149
|
+
readonly NaNValue: false;
|
|
150
150
|
readonly SafeInt: true;
|
|
151
151
|
} & Readonly<{
|
|
152
152
|
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|