ts-data-forge 14.10.1 → 14.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +4 -3
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs +1 -1
- 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 +10 -3
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +3 -3
- 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 +2 -1
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/built-in-tag.d.mts +22 -0
- package/dist/built-in-tag.d.mts.map +1 -0
- package/dist/built-in-tag.mjs +34 -0
- package/dist/built-in-tag.mjs.map +1 -0
- package/dist/collections/imap-mapped.mjs +6 -3
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.mjs +6 -3
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/stack.mjs +3 -3
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/iterator/range.d.mts +1 -1
- package/dist/iterator/range.d.mts.map +1 -1
- package/dist/iterator/range.mjs +5 -2
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/json.d.mts.map +1 -1
- package/dist/json/json.mjs +13 -47
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.d.mts +4 -9
- package/dist/number/branded-types/finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/finite-number.mjs +9 -9
- package/dist/number/branded-types/finite-number.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +3 -9
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int.mjs +9 -10
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/int16.d.mts +3 -18
- package/dist/number/branded-types/int16.d.mts.map +1 -1
- package/dist/number/branded-types/int16.mjs +9 -10
- package/dist/number/branded-types/int16.mjs.map +1 -1
- package/dist/number/branded-types/int32.d.mts +3 -14
- package/dist/number/branded-types/int32.d.mts.map +1 -1
- package/dist/number/branded-types/int32.mjs +9 -10
- package/dist/number/branded-types/int32.mjs.map +1 -1
- package/dist/number/branded-types/negative-finite-number.d.mts +4 -16
- package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/negative-finite-number.mjs +9 -10
- package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/negative-int.d.mts +3 -16
- package/dist/number/branded-types/negative-int.d.mts.map +1 -1
- package/dist/number/branded-types/negative-int.mjs +9 -11
- package/dist/number/branded-types/negative-int.mjs.map +1 -1
- package/dist/number/branded-types/negative-safe-int.d.mts +3 -17
- package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/negative-safe-int.mjs +9 -11
- package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.d.mts +4 -14
- package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.mjs +9 -9
- package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int16.d.mts +3 -19
- package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-int16.mjs +9 -10
- package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int32.d.mts +3 -17
- package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-int32.mjs +9 -10
- package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.d.mts +4 -14
- package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.mjs +9 -9
- package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-int.d.mts +3 -14
- package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-int.mjs +9 -10
- package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.d.mts +3 -15
- package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.mjs +9 -10
- 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 -10
- package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs +9 -10
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.d.mts +3 -10
- package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int.mjs +9 -11
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.d.mts +3 -19
- package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs +12 -11
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.d.mts +3 -15
- package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs +12 -11
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.d.mts +6 -14
- package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +9 -13
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.d.mts +3 -20
- package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs +9 -11
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.d.mts +3 -18
- package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs +9 -11
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.d.mts +4 -16
- package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/positive-finite-number.mjs +9 -9
- package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/positive-int.d.mts +3 -16
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +9 -10
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-int16.d.mts +3 -21
- package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int16.mjs +9 -10
- package/dist/number/branded-types/positive-int16.mjs.map +1 -1
- package/dist/number/branded-types/positive-int32.d.mts +3 -19
- package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int32.mjs +9 -10
- package/dist/number/branded-types/positive-int32.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +5 -19
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +9 -11
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint16.d.mts +3 -20
- package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint16.mjs +9 -10
- package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint32.d.mts +3 -18
- package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint32.mjs +9 -10
- package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +5 -12
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +9 -12
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.d.mts +3 -15
- package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
- package/dist/number/branded-types/safe-uint.mjs +9 -11
- package/dist/number/branded-types/safe-uint.mjs.map +1 -1
- package/dist/number/branded-types/uint.d.mts +3 -14
- package/dist/number/branded-types/uint.d.mts.map +1 -1
- package/dist/number/branded-types/uint.mjs +9 -10
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/branded-types/uint16.d.mts +3 -18
- package/dist/number/branded-types/uint16.d.mts.map +1 -1
- package/dist/number/branded-types/uint16.mjs +9 -10
- package/dist/number/branded-types/uint16.mjs.map +1 -1
- package/dist/number/branded-types/uint32.d.mts +3 -16
- package/dist/number/branded-types/uint32.d.mts.map +1 -1
- package/dist/number/branded-types/uint32.mjs +9 -10
- package/dist/number/branded-types/uint32.mjs.map +1 -1
- package/dist/number/enum/int8.d.mts +13 -15
- package/dist/number/enum/int8.d.mts.map +1 -1
- package/dist/number/enum/int8.mjs +20 -25
- package/dist/number/enum/int8.mjs.map +1 -1
- package/dist/number/enum/uint8.d.mts +12 -14
- package/dist/number/enum/uint8.d.mts.map +1 -1
- package/dist/number/enum/uint8.mjs +18 -23
- package/dist/number/enum/uint8.mjs.map +1 -1
- package/dist/number/index.d.mts +1 -1
- package/dist/number/index.d.mts.map +1 -1
- package/dist/number/index.mjs +1 -1
- package/dist/number/index.mjs.map +1 -1
- package/dist/number/num/impl/index.d.mts +2 -0
- package/dist/number/num/impl/index.d.mts.map +1 -0
- package/dist/number/num/impl/index.mjs +2 -0
- package/dist/number/num/impl/index.mjs.map +1 -0
- package/dist/number/num/impl/num.d.mts +531 -0
- package/dist/number/num/impl/num.d.mts.map +1 -0
- package/dist/number/num/impl/num.mjs +542 -0
- package/dist/number/num/impl/num.mjs.map +1 -0
- package/dist/number/num/index.d.mts +17 -0
- package/dist/number/num/index.d.mts.map +1 -0
- package/dist/number/num/index.mjs +17 -0
- package/dist/number/num/index.mjs.map +1 -0
- package/dist/number/operators/finite-number.d.mts +16 -0
- package/dist/number/operators/finite-number.d.mts.map +1 -0
- package/dist/number/operators/finite-number.mjs +7 -0
- package/dist/number/operators/finite-number.mjs.map +1 -0
- package/dist/number/operators/int.d.mts +16 -0
- package/dist/number/operators/int.d.mts.map +1 -0
- package/dist/number/operators/int.mjs +8 -0
- package/dist/number/operators/int.mjs.map +1 -0
- package/dist/number/operators/int16.d.mts +25 -0
- package/dist/number/operators/int16.d.mts.map +1 -0
- package/dist/number/operators/int16.mjs +8 -0
- package/dist/number/operators/int16.mjs.map +1 -0
- package/dist/number/operators/int32.d.mts +21 -0
- package/dist/number/operators/int32.d.mts.map +1 -0
- package/dist/number/operators/int32.mjs +8 -0
- package/dist/number/operators/int32.mjs.map +1 -0
- package/dist/number/operators/int8.d.mts +24 -0
- package/dist/number/operators/int8.d.mts.map +1 -0
- package/dist/number/operators/int8.mjs +8 -0
- package/dist/number/operators/int8.mjs.map +1 -0
- package/dist/number/operators/negative-finite-number.d.mts +11 -0
- package/dist/number/operators/negative-finite-number.d.mts.map +1 -0
- package/dist/number/operators/negative-finite-number.mjs +8 -0
- package/dist/number/operators/negative-finite-number.mjs.map +1 -0
- package/dist/number/operators/negative-int.d.mts +10 -0
- package/dist/number/operators/negative-int.d.mts.map +1 -0
- package/dist/number/operators/negative-int.mjs +9 -0
- package/dist/number/operators/negative-int.mjs.map +1 -0
- package/dist/number/operators/negative-safe-int.d.mts +10 -0
- package/dist/number/operators/negative-safe-int.d.mts.map +1 -0
- package/dist/number/operators/negative-safe-int.mjs +9 -0
- package/dist/number/operators/negative-safe-int.mjs.map +1 -0
- package/dist/number/operators/non-negative-finite-number.d.mts +22 -0
- package/dist/number/operators/non-negative-finite-number.d.mts.map +1 -0
- package/dist/number/operators/non-negative-finite-number.mjs +7 -0
- package/dist/number/operators/non-negative-finite-number.mjs.map +1 -0
- package/dist/number/operators/non-negative-int16.d.mts +27 -0
- package/dist/number/operators/non-negative-int16.d.mts.map +1 -0
- package/dist/number/operators/non-negative-int16.mjs +8 -0
- package/dist/number/operators/non-negative-int16.mjs.map +1 -0
- package/dist/number/operators/non-negative-int32.d.mts +25 -0
- package/dist/number/operators/non-negative-int32.d.mts.map +1 -0
- package/dist/number/operators/non-negative-int32.mjs +8 -0
- package/dist/number/operators/non-negative-int32.mjs.map +1 -0
- package/dist/number/operators/non-positive-finite-number.d.mts +11 -0
- package/dist/number/operators/non-positive-finite-number.d.mts.map +1 -0
- package/dist/number/operators/non-positive-finite-number.mjs +7 -0
- package/dist/number/operators/non-positive-finite-number.mjs.map +1 -0
- package/dist/number/operators/non-positive-int.d.mts +10 -0
- package/dist/number/operators/non-positive-int.d.mts.map +1 -0
- package/dist/number/operators/non-positive-int.mjs +8 -0
- package/dist/number/operators/non-positive-int.mjs.map +1 -0
- package/dist/number/operators/non-positive-safe-int.d.mts +10 -0
- package/dist/number/operators/non-positive-safe-int.d.mts.map +1 -0
- package/dist/number/operators/non-positive-safe-int.mjs +8 -0
- package/dist/number/operators/non-positive-safe-int.mjs.map +1 -0
- package/dist/number/operators/non-zero-finite-number.d.mts +16 -0
- package/dist/number/operators/non-zero-finite-number.d.mts.map +1 -0
- package/dist/number/operators/non-zero-finite-number.mjs +8 -0
- package/dist/number/operators/non-zero-finite-number.mjs.map +1 -0
- package/dist/number/operators/non-zero-int.d.mts +10 -0
- package/dist/number/operators/non-zero-int.d.mts.map +1 -0
- package/dist/number/operators/non-zero-int.mjs +9 -0
- package/dist/number/operators/non-zero-int.mjs.map +1 -0
- package/dist/number/operators/non-zero-int16.d.mts +10 -0
- package/dist/number/operators/non-zero-int16.d.mts.map +1 -0
- package/dist/number/operators/non-zero-int16.mjs +9 -0
- package/dist/number/operators/non-zero-int16.mjs.map +1 -0
- package/dist/number/operators/non-zero-int32.d.mts +10 -0
- package/dist/number/operators/non-zero-int32.d.mts.map +1 -0
- package/dist/number/operators/non-zero-int32.mjs +9 -0
- package/dist/number/operators/non-zero-int32.mjs.map +1 -0
- package/dist/number/operators/non-zero-safe-int.d.mts +10 -0
- package/dist/number/operators/non-zero-safe-int.d.mts.map +1 -0
- package/dist/number/operators/non-zero-safe-int.mjs +11 -0
- package/dist/number/operators/non-zero-safe-int.mjs.map +1 -0
- package/dist/number/operators/non-zero-uint16.d.mts +2 -0
- package/dist/number/operators/non-zero-uint16.d.mts.map +1 -0
- package/dist/number/operators/non-zero-uint16.mjs +9 -0
- package/dist/number/operators/non-zero-uint16.mjs.map +1 -0
- package/dist/number/operators/non-zero-uint32.d.mts +2 -0
- package/dist/number/operators/non-zero-uint32.d.mts.map +1 -0
- package/dist/number/operators/non-zero-uint32.mjs +9 -0
- package/dist/number/operators/non-zero-uint32.mjs.map +1 -0
- package/dist/number/operators/positive-finite-number.d.mts +23 -0
- package/dist/number/operators/positive-finite-number.d.mts.map +1 -0
- package/dist/number/operators/positive-finite-number.mjs +7 -0
- package/dist/number/operators/positive-finite-number.mjs.map +1 -0
- package/dist/number/operators/positive-int.d.mts +23 -0
- package/dist/number/operators/positive-int.d.mts.map +1 -0
- package/dist/number/operators/positive-int.mjs +8 -0
- package/dist/number/operators/positive-int.mjs.map +1 -0
- package/dist/number/operators/positive-int16.d.mts +28 -0
- package/dist/number/operators/positive-int16.d.mts.map +1 -0
- package/dist/number/operators/positive-int16.mjs +8 -0
- package/dist/number/operators/positive-int16.mjs.map +1 -0
- package/dist/number/operators/positive-int32.d.mts +26 -0
- package/dist/number/operators/positive-int32.d.mts.map +1 -0
- package/dist/number/operators/positive-int32.mjs +8 -0
- package/dist/number/operators/positive-int32.mjs.map +1 -0
- package/dist/number/operators/positive-safe-int.d.mts +24 -0
- package/dist/number/operators/positive-safe-int.d.mts.map +1 -0
- package/dist/number/operators/positive-safe-int.mjs +9 -0
- package/dist/number/operators/positive-safe-int.mjs.map +1 -0
- package/dist/number/operators/positive-uint16.d.mts +27 -0
- package/dist/number/operators/positive-uint16.d.mts.map +1 -0
- package/dist/number/operators/positive-uint16.mjs +8 -0
- package/dist/number/operators/positive-uint16.mjs.map +1 -0
- package/dist/number/operators/positive-uint32.d.mts +25 -0
- package/dist/number/operators/positive-uint32.d.mts.map +1 -0
- package/dist/number/operators/positive-uint32.mjs +8 -0
- package/dist/number/operators/positive-uint32.mjs.map +1 -0
- package/dist/number/operators/safe-int.d.mts +17 -0
- package/dist/number/operators/safe-int.d.mts.map +1 -0
- package/dist/number/operators/safe-int.mjs +10 -0
- package/dist/number/operators/safe-int.mjs.map +1 -0
- package/dist/number/operators/safe-uint.d.mts +22 -0
- package/dist/number/operators/safe-uint.d.mts.map +1 -0
- package/dist/number/operators/safe-uint.mjs +9 -0
- package/dist/number/operators/safe-uint.mjs.map +1 -0
- package/dist/number/operators/uint.d.mts +14 -0
- package/dist/number/operators/uint.d.mts.map +1 -0
- package/dist/number/operators/uint.mjs +8 -0
- package/dist/number/operators/uint.mjs.map +1 -0
- package/dist/number/operators/uint16.d.mts +25 -0
- package/dist/number/operators/uint16.d.mts.map +1 -0
- package/dist/number/operators/uint16.mjs +8 -0
- package/dist/number/operators/uint16.mjs.map +1 -0
- package/dist/number/operators/uint32.d.mts +23 -0
- package/dist/number/operators/uint32.d.mts.map +1 -0
- package/dist/number/operators/uint32.mjs +8 -0
- package/dist/number/operators/uint32.mjs.map +1 -0
- package/dist/number/operators/uint8.d.mts +24 -0
- package/dist/number/operators/uint8.d.mts.map +1 -0
- package/dist/number/operators/uint8.mjs +8 -0
- package/dist/number/operators/uint8.mjs.map +1 -0
- package/dist/number/refined-number-utils.d.mts +2 -2
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs +1 -1
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.d.mts +8 -0
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +17 -5
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/fast-deep-equal.mjs +1 -1
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/dist/others/replace-equal-deep.mjs +10 -3
- package/dist/others/replace-equal-deep.mjs.map +1 -1
- package/package.json +22 -9
- package/src/array/impl/array-utils-reducing-value.mts +4 -3
- package/src/array/impl/array-utils-shape-invariants.test.mts +1 -1
- package/src/array/impl/array-utils-slice-clamped.mts +1 -1
- package/src/array/impl/array-utils-slicing.mts +12 -3
- package/src/array/impl/array-utils-transformation.mts +7 -3
- package/src/array/impl/array-utils-transformation.test.mts +52 -3
- package/src/array/impl/array-utils-validation.mts +2 -1
- package/src/built-in-tag.mts +59 -0
- package/src/built-in-tag.test.mts +215 -0
- package/src/collections/imap-mapped.mts +6 -4
- package/src/collections/imap-mapped.test.mts +27 -0
- package/src/collections/imap.mts +6 -4
- package/src/collections/imap.test.mts +13 -0
- package/src/collections/stack.mts +3 -3
- package/src/iterator/range.mts +10 -2
- package/src/iterator/range.test.mts +7 -0
- package/src/json/json.mts +17 -57
- package/src/json/json.test.mts +32 -0
- package/src/number/branded-types/finite-number.mts +23 -25
- package/src/number/branded-types/int.mts +20 -26
- package/src/number/branded-types/int16.mts +21 -26
- package/src/number/branded-types/int32.mts +21 -26
- package/src/number/branded-types/negative-finite-number.mts +25 -26
- package/src/number/branded-types/negative-int.mts +20 -27
- package/src/number/branded-types/negative-safe-int.mts +23 -28
- package/src/number/branded-types/non-negative-finite-number.mts +24 -25
- package/src/number/branded-types/non-negative-int16.mts +23 -26
- package/src/number/branded-types/non-negative-int32.mts +23 -26
- package/src/number/branded-types/non-positive-finite-number.mts +24 -25
- package/src/number/branded-types/non-positive-int.mts +20 -26
- package/src/number/branded-types/non-positive-safe-int.mts +21 -26
- package/src/number/branded-types/non-zero-finite-number.mts +23 -25
- package/src/number/branded-types/non-zero-int.mts +19 -25
- package/src/number/branded-types/non-zero-int16.mts +27 -28
- package/src/number/branded-types/non-zero-int32.mts +27 -28
- package/src/number/branded-types/non-zero-safe-int.mts +25 -35
- package/src/number/branded-types/non-zero-uint16.mts +24 -28
- package/src/number/branded-types/non-zero-uint32.mts +24 -28
- package/src/number/branded-types/positive-finite-number.mts +25 -25
- package/src/number/branded-types/positive-int.mts +21 -26
- package/src/number/branded-types/positive-int16.mts +23 -26
- package/src/number/branded-types/positive-int32.mts +23 -26
- package/src/number/branded-types/positive-safe-int.mts +24 -31
- package/src/number/branded-types/positive-uint16.mts +23 -26
- package/src/number/branded-types/positive-uint32.mts +23 -26
- package/src/number/branded-types/safe-int.mts +22 -29
- package/src/number/branded-types/safe-uint.mts +21 -27
- package/src/number/branded-types/uint.mts +21 -26
- package/src/number/branded-types/uint16.mts +21 -26
- package/src/number/branded-types/uint32.mts +21 -26
- package/src/number/enum/int8.mts +40 -52
- package/src/number/enum/uint8.mts +40 -48
- package/src/number/index.mts +1 -1
- package/src/number/num/impl/index.mts +1 -0
- package/src/number/num/impl/num.mts +715 -0
- package/src/number/{num.test.mts → num/impl/num.test.mts} +17 -5
- package/src/number/num/index.mts +16 -0
- package/src/number/num-arithmetic.test.mts +1 -1
- package/src/number/operators/finite-number.mts +20 -0
- package/src/number/operators/int.mts +20 -0
- package/src/number/operators/int16.mts +33 -0
- package/src/number/operators/int32.mts +33 -0
- package/src/number/operators/int8.mts +18 -0
- package/src/number/operators/negative-finite-number.mts +22 -0
- package/src/number/operators/negative-int.mts +22 -0
- package/src/number/operators/negative-safe-int.mts +32 -0
- package/src/number/operators/non-negative-finite-number.mts +32 -0
- package/src/number/operators/non-negative-int16.mts +33 -0
- package/src/number/operators/non-negative-int32.mts +33 -0
- package/src/number/operators/non-positive-finite-number.mts +21 -0
- package/src/number/operators/non-positive-int.mts +21 -0
- package/src/number/operators/non-positive-safe-int.mts +31 -0
- package/src/number/operators/non-zero-finite-number.mts +21 -0
- package/src/number/operators/non-zero-int.mts +22 -0
- package/src/number/operators/non-zero-int16.mts +32 -0
- package/src/number/operators/non-zero-int32.mts +32 -0
- package/src/number/operators/non-zero-safe-int.mts +34 -0
- package/src/number/operators/non-zero-uint16.mts +32 -0
- package/src/number/operators/non-zero-uint32.mts +32 -0
- package/src/number/operators/positive-finite-number.mts +32 -0
- package/src/number/operators/positive-int.mts +32 -0
- package/src/number/operators/positive-int16.mts +33 -0
- package/src/number/operators/positive-int32.mts +33 -0
- package/src/number/operators/positive-safe-int.mts +34 -0
- package/src/number/operators/positive-uint16.mts +33 -0
- package/src/number/operators/positive-uint32.mts +33 -0
- package/src/number/operators/safe-int.mts +35 -0
- package/src/number/operators/safe-uint.mts +33 -0
- package/src/number/operators/uint.mts +31 -0
- package/src/number/operators/uint16.mts +32 -0
- package/src/number/operators/uint32.mts +32 -0
- package/src/number/operators/uint8.mts +16 -0
- package/src/number/refined-number-utils.mts +4 -4
- package/src/object/object.mts +33 -5
- package/src/object/object.test.mts +55 -0
- package/src/others/fast-deep-equal.mts +1 -1
- package/src/others/replace-equal-deep.mts +11 -4
- package/src/others/replace-equal-deep.test.mts +26 -0
- package/dist/number/num.d.mts +0 -546
- package/dist/number/num.d.mts.map +0 -1
- package/dist/number/num.mjs +0 -559
- package/dist/number/num.mjs.map +0 -1
- package/src/guard/is-error.test.mts +0 -145
- package/src/number/num.mts +0 -731
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/safe-uint.mjs';
|
|
3
3
|
const typeNameInMessage = 'a non-negative safe integer';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
MIN_VALUE: 0,
|
|
7
4
|
|
|
8
|
-
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
9
|
-
typeNameInMessage,
|
|
10
|
-
});
|
|
11
5
|
|
|
12
6
|
|
|
13
7
|
|
|
@@ -16,8 +10,8 @@ const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min
|
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
13
|
+
export const isSafeUint = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
19
14
|
|
|
20
|
-
export const isSafeUint = is;
|
|
21
15
|
|
|
22
16
|
|
|
23
17
|
|
|
@@ -27,8 +21,12 @@ export const isSafeUint = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
export const asSafeUint = (value) => {
|
|
25
|
+
if (!isSafeUint(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
|
|
@@ -43,7 +41,7 @@ export const SafeUint = {
|
|
|
43
41
|
|
|
44
42
|
|
|
45
43
|
|
|
46
|
-
is,
|
|
44
|
+
is: isSafeUint,
|
|
47
45
|
|
|
48
46
|
|
|
49
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-uint.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/safe-uint.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"safe-uint.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/safe-uint.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,4BAA4B,CAAC;AAOpC,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAqB,EAAE,CAC7D,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAmB,KAAQ,EAAgB,EAAE;IACrE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;;;;;;OAMG;IACH,EAAE,EAAE,UAAU;IAEd;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;OASG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -20,7 +20,7 @@ export type Uint = TtfImported_Uint;
|
|
|
20
20
|
* @param value - The value to check
|
|
21
21
|
* @returns `true` if the value is a non-negative integer, `false` otherwise
|
|
22
22
|
*/
|
|
23
|
-
export declare const isUint: (
|
|
23
|
+
export declare const isUint: (value: number) => value is Uint;
|
|
24
24
|
/**
|
|
25
25
|
* Casts a `number` to the `Uint` branded type.
|
|
26
26
|
*
|
|
@@ -41,18 +41,7 @@ export declare const isUint: (a: number) => a is import("ts-type-forge").NonNega
|
|
|
41
41
|
* @returns The value as an `Uint`
|
|
42
42
|
* @throws {TypeError} If the value is not a non-negative integer
|
|
43
43
|
*/
|
|
44
|
-
export declare const asUint: <N extends number>(
|
|
45
|
-
readonly "> -2^16": true;
|
|
46
|
-
readonly "> -2^32": true;
|
|
47
|
-
readonly ">= -2^15": true;
|
|
48
|
-
readonly ">= -2^31": true;
|
|
49
|
-
readonly ">=0": true;
|
|
50
|
-
readonly Finite: true;
|
|
51
|
-
readonly Int: true;
|
|
52
|
-
readonly NaNValue: false;
|
|
53
|
-
} & Readonly<{
|
|
54
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
55
|
-
}> & N;
|
|
44
|
+
export declare const asUint: <N extends number>(value: N) => Uint & N;
|
|
56
45
|
/**
|
|
57
46
|
* Namespace providing type-safe operations for the `Uint` branded type.
|
|
58
47
|
*
|
|
@@ -81,7 +70,7 @@ export declare const Uint: {
|
|
|
81
70
|
* @returns `true` if the value is a non-negative integer, `false` otherwise
|
|
82
71
|
* @see {@link isUint} for usage examples
|
|
83
72
|
*/
|
|
84
|
-
readonly is:
|
|
73
|
+
readonly is: typeof isUint;
|
|
85
74
|
/**
|
|
86
75
|
* The smallest value representable as `Uint` (the lower saturation target of
|
|
87
76
|
* `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAgB9D,MAAM,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAMpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,KAAK,IAAI,IACT,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,IAAI,GAAG,CAM1D,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;OAGG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;OAeG;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/uint.mjs';
|
|
3
3
|
const typeNameInMessage = 'a non-negative integer';
|
|
4
|
-
const { MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'Integer',
|
|
6
|
-
MIN_VALUE: 0,
|
|
7
|
-
MAX_VALUE: Number.MAX_VALUE,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -27,7 +21,7 @@ const { MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const isUint =
|
|
24
|
+
export const isUint = (value) => Number.isInteger(value) && value >= 0;
|
|
31
25
|
|
|
32
26
|
|
|
33
27
|
|
|
@@ -48,7 +42,12 @@ export const isUint = is;
|
|
|
48
42
|
|
|
49
43
|
|
|
50
44
|
|
|
51
|
-
export const asUint =
|
|
45
|
+
export const asUint = (value) => {
|
|
46
|
+
if (!isUint(value)) {
|
|
47
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
};
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
|
|
@@ -77,7 +76,7 @@ export const Uint = {
|
|
|
77
76
|
|
|
78
77
|
|
|
79
78
|
|
|
80
|
-
is,
|
|
79
|
+
is: isUint,
|
|
81
80
|
|
|
82
81
|
|
|
83
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"uint.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,uBAAuB,CAAC;AAO/B,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAiB,EAAE,CACrD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAmB,KAAQ,EAAY,EAAE;IAC7D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,EAAE,MAAM;IAEV;;;OAGG;IACH,SAAS;IAET;;;;;;;;;;;;;OAaG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;OAaG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU;IAEV;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM;IAEN;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;OAeG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type Uint16 = TtfImported_Uint16;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isUint16: (
|
|
12
|
+
export declare const isUint16: (value: number) => value is Uint16;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `Uint16` branded type.
|
|
15
15
|
*
|
|
@@ -20,22 +20,7 @@ export declare const isUint16: (a: number) => a is TtfImported_Uint16;
|
|
|
20
20
|
* @returns The value as an `Uint16`
|
|
21
21
|
* @throws {TypeError} If the value is not a non-negative integer less than 2^16
|
|
22
22
|
*/
|
|
23
|
-
export declare const asUint16: <N extends number>(
|
|
24
|
-
readonly "< 2^16": true;
|
|
25
|
-
readonly "< 2^31": true;
|
|
26
|
-
readonly "< 2^32": true;
|
|
27
|
-
readonly "> -2^16": true;
|
|
28
|
-
readonly "> -2^32": true;
|
|
29
|
-
readonly ">= -2^15": true;
|
|
30
|
-
readonly ">= -2^31": true;
|
|
31
|
-
readonly ">=0": true;
|
|
32
|
-
readonly Finite: true;
|
|
33
|
-
readonly Int: true;
|
|
34
|
-
readonly NaNValue: false;
|
|
35
|
-
readonly SafeInt: true;
|
|
36
|
-
} & Readonly<{
|
|
37
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
38
|
-
}> & N;
|
|
23
|
+
export declare const asUint16: <N extends number>(value: N) => Uint16 & N;
|
|
39
24
|
/**
|
|
40
25
|
* Namespace providing type-safe operations for the `Uint16` branded type.
|
|
41
26
|
*
|
|
@@ -50,7 +35,7 @@ export declare const Uint16: {
|
|
|
50
35
|
* @returns `true` if the value is a non-negative integer less than 2^16, `false` otherwise
|
|
51
36
|
* @see {@link isUint16} for usage examples
|
|
52
37
|
*/
|
|
53
|
-
readonly is:
|
|
38
|
+
readonly is: typeof isUint16;
|
|
54
39
|
/**
|
|
55
40
|
* The smallest value representable as `Uint16` (the lower saturation target
|
|
56
41
|
* of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAiBlE,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAMxC;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,UAAW,MAAM,KAAG,KAAK,IAAI,MACiB,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,MAAM,GAAG,CAM9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/uint16.mjs';
|
|
3
3
|
const typeNameInMessage = 'a non-negative integer less than 2^16';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
MIN_VALUE: 0,
|
|
7
|
-
MAX_VALUE: 2 ** 16 - 1,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -16,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min
|
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
19
|
-
export const isUint16 =
|
|
13
|
+
export const isUint16 = (value) => Number.isSafeInteger(value) && 0 <= value && value <= 2 ** 16 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isUint16 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asUint16 =
|
|
24
|
+
export const asUint16 = (value) => {
|
|
25
|
+
if (!isUint16(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
@@ -42,7 +41,7 @@ export const Uint16 = {
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
is,
|
|
44
|
+
is: isUint16,
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,yBAAyB,CAAC;AAOjC,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAmB,EAAE,CACzD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAmB,KAAQ,EAAc,EAAE;IACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;;;;OAMG;IACH,EAAE,EAAE,QAAQ;IAEZ;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;OASG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type Uint32 = TtfImported_Uint32;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isUint32: (
|
|
12
|
+
export declare const isUint32: (value: number) => value is Uint32;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `Uint32` branded type.
|
|
15
15
|
*
|
|
@@ -20,20 +20,7 @@ export declare const isUint32: (a: number) => a is TtfImported_Uint32;
|
|
|
20
20
|
* @returns The value as an `Uint32`
|
|
21
21
|
* @throws {TypeError} If the value is not a non-negative integer less than 2^32
|
|
22
22
|
*/
|
|
23
|
-
export declare const asUint32: <N extends number>(
|
|
24
|
-
readonly "< 2^32": true;
|
|
25
|
-
readonly "> -2^16": true;
|
|
26
|
-
readonly "> -2^32": true;
|
|
27
|
-
readonly ">= -2^15": true;
|
|
28
|
-
readonly ">= -2^31": true;
|
|
29
|
-
readonly ">=0": true;
|
|
30
|
-
readonly Finite: true;
|
|
31
|
-
readonly Int: true;
|
|
32
|
-
readonly NaNValue: false;
|
|
33
|
-
readonly SafeInt: true;
|
|
34
|
-
} & Readonly<{
|
|
35
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
36
|
-
}> & N;
|
|
23
|
+
export declare const asUint32: <N extends number>(value: N) => Uint32 & N;
|
|
37
24
|
/**
|
|
38
25
|
* Namespace providing type-safe operations for the `Uint32` branded type.
|
|
39
26
|
*
|
|
@@ -48,7 +35,7 @@ export declare const Uint32: {
|
|
|
48
35
|
* @returns `true` if the value is a non-negative integer less than 2^32, `false` otherwise
|
|
49
36
|
* @see {@link isUint32} for usage examples
|
|
50
37
|
*/
|
|
51
|
-
readonly is:
|
|
38
|
+
readonly is: typeof isUint32;
|
|
52
39
|
/**
|
|
53
40
|
* The smallest value representable as `Uint32` (the lower saturation target
|
|
54
41
|
* of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAiBlE,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAMxC;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,UAAW,MAAM,KAAG,KAAK,IAAI,MACiB,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,MAAM,GAAG,CAM9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/uint32.mjs';
|
|
3
3
|
const typeNameInMessage = 'a non-negative integer less than 2^32';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
MIN_VALUE: 0,
|
|
7
|
-
MAX_VALUE: 2 ** 32 - 1,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -16,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min
|
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
19
|
-
export const isUint32 =
|
|
13
|
+
export const isUint32 = (value) => Number.isSafeInteger(value) && 0 <= value && value <= 2 ** 32 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isUint32 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asUint32 =
|
|
24
|
+
export const asUint32 = (value) => {
|
|
25
|
+
if (!isUint32(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
@@ -42,7 +41,7 @@ export const Uint32 = {
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
is,
|
|
44
|
+
is: isUint32,
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/uint32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,yBAAyB,CAAC;AAOjC,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAmB,EAAE,CACzD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAmB,KAAQ,EAAc,EAAE;IACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;;;;OAMG;IACH,EAAE,EAAE,QAAQ;IAEZ;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;OASG;IACH,UAAU;IAEV;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import type { AbsoluteValue, StrictExclude, Int8 as TtfImported_Int8 } from 'ts-type-forge';
|
|
2
2
|
export type Int8 = TtfImported_Int8;
|
|
3
|
-
declare const is: (x: number) => x is Int8;
|
|
4
|
-
declare const castType: (x: number) => Int8;
|
|
5
|
-
declare const fromNumber: (a: number) => Int8;
|
|
6
|
-
declare const abs: <N extends Int8>(x: N) => AbsoluteValue<N>;
|
|
7
|
-
declare const min_: (...values: readonly Int8[]) => Int8;
|
|
8
|
-
declare const max_: (...values: readonly Int8[]) => Int8;
|
|
9
|
-
declare const pow: (x: Int8, y: Int8) => Int8;
|
|
10
|
-
declare const add: (x: Int8, y: Int8) => Int8;
|
|
11
|
-
declare const sub: (x: Int8, y: Int8) => Int8;
|
|
12
|
-
declare const mul: (x: Int8, y: Int8) => Int8;
|
|
13
|
-
declare const div: (x: Int8, y: StrictExclude<Int8, 0>) => Int8;
|
|
14
|
-
declare const random: (min: Int8, max: Int8) => Int8;
|
|
15
3
|
/**
|
|
16
4
|
* Type guard that checks if a value is an integer in [-128, 127].
|
|
17
5
|
*
|
|
@@ -21,7 +9,7 @@ declare const random: (min: Int8, max: Int8) => Int8;
|
|
|
21
9
|
* @param value - The value to check
|
|
22
10
|
* @returns `true` if the value is an integer in [-128, 127], `false` otherwise
|
|
23
11
|
*/
|
|
24
|
-
export declare const isInt8:
|
|
12
|
+
export declare const isInt8: (value: number) => value is Int8;
|
|
25
13
|
/**
|
|
26
14
|
* Casts a `number` to the `Int8` branded type.
|
|
27
15
|
*
|
|
@@ -32,7 +20,17 @@ export declare const isInt8: typeof is;
|
|
|
32
20
|
* @returns The value as an `Int8`
|
|
33
21
|
* @throws {TypeError} If the value is not an integer in [-128, 127]
|
|
34
22
|
*/
|
|
35
|
-
export declare const asInt8:
|
|
23
|
+
export declare const asInt8: (value: number) => Int8;
|
|
24
|
+
declare const fromNumber: (a: number) => Int8;
|
|
25
|
+
declare const abs: <N extends Int8>(x: N) => AbsoluteValue<N>;
|
|
26
|
+
declare const min_: (...values: readonly Int8[]) => Int8;
|
|
27
|
+
declare const max_: (...values: readonly Int8[]) => Int8;
|
|
28
|
+
declare const pow: (x: Int8, y: Int8) => Int8;
|
|
29
|
+
declare const add: (x: Int8, y: Int8) => Int8;
|
|
30
|
+
declare const sub: (x: Int8, y: Int8) => Int8;
|
|
31
|
+
declare const mul: (x: Int8, y: Int8) => Int8;
|
|
32
|
+
declare const div: (x: Int8, y: StrictExclude<Int8, 0>) => Int8;
|
|
33
|
+
declare const random: (min: Int8, max: Int8) => Int8;
|
|
36
34
|
/**
|
|
37
35
|
* Namespace providing type-safe operations for the `Int8` branded type.
|
|
38
36
|
*
|
|
@@ -47,7 +45,7 @@ export declare const Int8: {
|
|
|
47
45
|
* @returns `true` if the value is an integer in [-128, 127], `false` otherwise
|
|
48
46
|
* @see {@link isInt8} for usage examples
|
|
49
47
|
*/
|
|
50
|
-
readonly is: typeof
|
|
48
|
+
readonly is: typeof isInt8;
|
|
51
49
|
/**
|
|
52
50
|
* The smallest value representable as `Int8` (the lower saturation target of
|
|
53
51
|
* `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/int8.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,IAAI,IAAI,gBAAgB,EACzB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/int8.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,IAAI,IAAI,gBAAgB,EACzB,MAAM,eAAe,CAAC;AAWvB,MAAM,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAIpC;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,KAAK,IAAI,IACc,CAAC;AAE/D;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,IAMtC,CAAC;AAEF,QAAA,MAAM,UAAU,MAAO,MAAM,KAAG,IAAiC,CAAC;AAElE,QAAA,MAAM,GAAG,GAAI,CAAC,SAAS,IAAI,KAAK,CAAC,KAAG,aAAa,CAAC,CAAC,CAEP,CAAC;AAE7C,QAAA,MAAM,IAAI,cAAe,SAAS,IAAI,EAAE,KAAG,IAAmC,CAAC;AAE/E,QAAA,MAAM,IAAI,cAAe,SAAS,IAAI,EAAE,KAAG,IAAmC,CAAC;AAE/E,QAAA,MAAM,GAAG,MAAO,IAAI,KAAK,IAAI,KAAG,IAA0B,CAAC;AAE3D,QAAA,MAAM,GAAG,MAAO,IAAI,KAAK,IAAI,KAAG,IAAyB,CAAC;AAE1D,QAAA,MAAM,GAAG,MAAO,IAAI,KAAK,IAAI,KAAG,IAAyB,CAAC;AAE1D,QAAA,MAAM,GAAG,MAAO,IAAI,KAAK,IAAI,KAAG,IAAyB,CAAC;AAE1D,QAAA,MAAM,GAAG,MAAO,IAAI,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAG,IACnB,CAAC;AAEhC,QAAA,MAAM,MAAM,QAAS,IAAI,OAAO,IAAI,KAAG,IACmB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, castType as castTypeImpl, fromNumber as fromNumberImpl, random as randomImpl, } from '../operators/int8.mjs';
|
|
3
3
|
const typeNameInMessage = 'an integer in [-128, 127]';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, castType: castTypeImpl, fromNumber: fromNumberImpl, is: isImpl, random: randomImpl, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
MIN_VALUE: -128,
|
|
7
|
-
MAX_VALUE: 127,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
|
-
const is = (x) => isImpl(x);
|
|
11
|
-
const castType = (x) =>
|
|
12
|
-
|
|
13
|
-
castTypeImpl(x);
|
|
14
|
-
const fromNumber = (a) => castType(fromNumberImpl(a));
|
|
15
|
-
const abs = (x) =>
|
|
16
4
|
|
|
17
|
-
Math.abs(x);
|
|
18
|
-
const min_ = (...values) => castType(Math.min(...values));
|
|
19
|
-
const max_ = (...values) => castType(Math.max(...values));
|
|
20
|
-
const pow = (x, y) => fromNumber(x ** y);
|
|
21
|
-
const add = (x, y) => fromNumber(x + y);
|
|
22
|
-
const sub = (x, y) => fromNumber(x - y);
|
|
23
|
-
const mul = (x, y) => fromNumber(x * y);
|
|
24
|
-
const div = (x, y) => fromNumber(Math.floor(x / y));
|
|
25
|
-
const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
26
5
|
|
|
27
6
|
|
|
28
7
|
|
|
@@ -31,8 +10,8 @@ const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl
|
|
|
31
10
|
|
|
32
11
|
|
|
33
12
|
|
|
13
|
+
export const isInt8 = (value) => Number.isSafeInteger(value) && -128 <= value && value <= 127;
|
|
34
14
|
|
|
35
|
-
export const isInt8 = is;
|
|
36
15
|
|
|
37
16
|
|
|
38
17
|
|
|
@@ -42,8 +21,24 @@ export const isInt8 = is;
|
|
|
42
21
|
|
|
43
22
|
|
|
44
23
|
|
|
24
|
+
export const asInt8 = (value) => {
|
|
25
|
+
if (!isInt8(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
const fromNumber = (a) => asInt8(fromNumberImpl(a));
|
|
31
|
+
const abs = (x) =>
|
|
45
32
|
|
|
46
|
-
|
|
33
|
+
Math.abs(x);
|
|
34
|
+
const min_ = (...values) => asInt8(Math.min(...values));
|
|
35
|
+
const max_ = (...values) => asInt8(Math.max(...values));
|
|
36
|
+
const pow = (x, y) => fromNumber(x ** y);
|
|
37
|
+
const add = (x, y) => fromNumber(x + y);
|
|
38
|
+
const sub = (x, y) => fromNumber(x - y);
|
|
39
|
+
const mul = (x, y) => fromNumber(x * y);
|
|
40
|
+
const div = (x, y) => fromNumber(Math.floor(x / y));
|
|
41
|
+
const random = (min, max) => asInt8(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
47
42
|
|
|
48
43
|
|
|
49
44
|
|
|
@@ -58,7 +53,7 @@ export const Int8 = {
|
|
|
58
53
|
|
|
59
54
|
|
|
60
55
|
|
|
61
|
-
is,
|
|
56
|
+
is: isInt8,
|
|
62
57
|
|
|
63
58
|
|
|
64
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int8.mjs","sourceRoot":"","sources":["../../../src/number/enum/int8.mts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"int8.mjs","sourceRoot":"","sources":["../../../src/number/enum/int8.mts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,IAAI,YAAY,EACxB,UAAU,IAAI,cAAc,EAC5B,MAAM,IAAI,UAAU,GACrB,MAAM,uBAAuB,CAAC;AAK/B,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAiB,EAAE,CACrD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAQ,EAAE;IAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,CAAS,EAAQ,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE,MAAM,GAAG,GAAG,CAAiB,CAAI,EAAoB,EAAE;AACrD,kOAAkO;AAClO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAgC,CAAC;AAE7C,MAAM,IAAI,GAAG,CAAC,GAAG,MAAuB,EAAQ,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAE/E,MAAM,IAAI,GAAG,CAAC,GAAG,MAAuB,EAAQ,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAE/E,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAE3D,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAQ,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAyB,EAAQ,EAAE,CACvD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhC,MAAM,MAAM,GAAG,CAAC,GAAS,EAAE,GAAS,EAAQ,EAAE,CAC5C,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB;;;;;;OAMG;IACH,EAAE,EAAE,MAAM;IAEV;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;OASG;IACH,UAAU;IAEV;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import type { StrictExclude, Uint8 as TtfImported_Uint8 } from 'ts-type-forge';
|
|
2
2
|
export type Uint8 = TtfImported_Uint8;
|
|
3
|
-
declare const is: (x: number) => x is Uint8;
|
|
4
|
-
declare const castType: (x: number) => Uint8;
|
|
5
|
-
declare const fromNumber: (a: number) => Uint8;
|
|
6
|
-
declare const min_: (...values: readonly Uint8[]) => Uint8;
|
|
7
|
-
declare const max_: (...values: readonly Uint8[]) => Uint8;
|
|
8
|
-
declare const pow: (x: Uint8, y: Uint8) => Uint8;
|
|
9
|
-
declare const add: (x: Uint8, y: Uint8) => Uint8;
|
|
10
|
-
declare const sub: (x: Uint8, y: Uint8) => Uint8;
|
|
11
|
-
declare const mul: (x: Uint8, y: Uint8) => Uint8;
|
|
12
|
-
declare const div: (x: Uint8, y: StrictExclude<Uint8, 0>) => Uint8;
|
|
13
|
-
declare const random: (min: Uint8, max: Uint8) => Uint8;
|
|
14
3
|
/**
|
|
15
4
|
* Type guard that checks if a value is an non-negative integer less than 256.
|
|
16
5
|
*
|
|
@@ -20,7 +9,7 @@ declare const random: (min: Uint8, max: Uint8) => Uint8;
|
|
|
20
9
|
* @param value - The value to check
|
|
21
10
|
* @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
|
|
22
11
|
*/
|
|
23
|
-
export declare const isUint8:
|
|
12
|
+
export declare const isUint8: (value: number) => value is Uint8;
|
|
24
13
|
/**
|
|
25
14
|
* Casts a `number` to the `Uint8` branded type.
|
|
26
15
|
*
|
|
@@ -31,7 +20,16 @@ export declare const isUint8: typeof is;
|
|
|
31
20
|
* @returns The value as an `Uint8`
|
|
32
21
|
* @throws {TypeError} If the value is not an non-negative integer less than 256
|
|
33
22
|
*/
|
|
34
|
-
export declare const asUint8:
|
|
23
|
+
export declare const asUint8: (value: number) => Uint8;
|
|
24
|
+
declare const fromNumber: (a: number) => Uint8;
|
|
25
|
+
declare const min_: (...values: readonly Uint8[]) => Uint8;
|
|
26
|
+
declare const max_: (...values: readonly Uint8[]) => Uint8;
|
|
27
|
+
declare const pow: (x: Uint8, y: Uint8) => Uint8;
|
|
28
|
+
declare const add: (x: Uint8, y: Uint8) => Uint8;
|
|
29
|
+
declare const sub: (x: Uint8, y: Uint8) => Uint8;
|
|
30
|
+
declare const mul: (x: Uint8, y: Uint8) => Uint8;
|
|
31
|
+
declare const div: (x: Uint8, y: StrictExclude<Uint8, 0>) => Uint8;
|
|
32
|
+
declare const random: (min: Uint8, max: Uint8) => Uint8;
|
|
35
33
|
/**
|
|
36
34
|
* Namespace providing type-safe operations for the `Uint8` branded type.
|
|
37
35
|
*
|
|
@@ -46,7 +44,7 @@ export declare const Uint8: {
|
|
|
46
44
|
* @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
|
|
47
45
|
* @see {@link isUint8} for usage examples
|
|
48
46
|
*/
|
|
49
|
-
readonly is: typeof
|
|
47
|
+
readonly is: typeof isUint8;
|
|
50
48
|
/**
|
|
51
49
|
* The smallest value representable as `Uint8` (the lower saturation target of
|
|
52
50
|
* `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,KAAK,IAAI,iBAAiB,EAE3B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,KAAK,IAAI,iBAAiB,EAE3B,MAAM,eAAe,CAAC;AAWvB,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAItC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,KAAK,IAAI,KACU,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,KAMvC,CAAC;AAEF,QAAA,MAAM,UAAU,MAAO,MAAM,KAAG,KAAmC,CAAC;AAEpE,QAAA,MAAM,IAAI,cAAe,SAAS,KAAK,EAAE,KAAG,KACd,CAAC;AAE/B,QAAA,MAAM,IAAI,cAAe,SAAS,KAAK,EAAE,KAAG,KACd,CAAC;AAE/B,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA2B,CAAC;AAE9D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,KAAG,KACrB,CAAC;AAEhC,QAAA,MAAM,MAAM,QAAS,KAAK,OAAO,KAAK,KAAG,KACkB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
|
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, castType as castTypeImpl, fromNumber as fromNumberImpl, random as randomImpl, } from '../operators/uint8.mjs';
|
|
3
3
|
const typeNameInMessage = 'an non-negative integer less than 256';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, castType: castTypeImpl, fromNumber: fromNumberImpl, is: isImpl, random: randomImpl, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
|
-
MIN_VALUE: 0,
|
|
7
|
-
MAX_VALUE: 255,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
|
-
const is = (x) => isImpl(x);
|
|
11
|
-
const castType = (x) =>
|
|
12
|
-
|
|
13
|
-
castTypeImpl(x);
|
|
14
|
-
const fromNumber = (a) => castType(fromNumberImpl(a));
|
|
15
|
-
const min_ = (...values) => castType(Math.min(...values));
|
|
16
|
-
const max_ = (...values) => castType(Math.max(...values));
|
|
17
|
-
const pow = (x, y) => fromNumber(x ** y);
|
|
18
|
-
const add = (x, y) => fromNumber(x + y);
|
|
19
|
-
const sub = (x, y) => fromNumber(x - y);
|
|
20
|
-
const mul = (x, y) => fromNumber(x * y);
|
|
21
|
-
const div = (x, y) => fromNumber(Math.floor(x / y));
|
|
22
|
-
const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
23
4
|
|
|
24
5
|
|
|
25
6
|
|
|
@@ -29,7 +10,7 @@ const random = (min, max) => castType(randomImpl(castTypeImpl(min), castTypeImpl
|
|
|
29
10
|
|
|
30
11
|
|
|
31
12
|
|
|
32
|
-
export const isUint8 =
|
|
13
|
+
export const isUint8 = (value) => Number.isSafeInteger(value) && 0 <= value && value <= 255;
|
|
33
14
|
|
|
34
15
|
|
|
35
16
|
|
|
@@ -40,7 +21,21 @@ export const isUint8 = is;
|
|
|
40
21
|
|
|
41
22
|
|
|
42
23
|
|
|
43
|
-
export const asUint8 =
|
|
24
|
+
export const asUint8 = (value) => {
|
|
25
|
+
if (!isUint8(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
const fromNumber = (a) => asUint8(fromNumberImpl(a));
|
|
31
|
+
const min_ = (...values) => asUint8(Math.min(...values));
|
|
32
|
+
const max_ = (...values) => asUint8(Math.max(...values));
|
|
33
|
+
const pow = (x, y) => fromNumber(x ** y);
|
|
34
|
+
const add = (x, y) => fromNumber(x + y);
|
|
35
|
+
const sub = (x, y) => fromNumber(x - y);
|
|
36
|
+
const mul = (x, y) => fromNumber(x * y);
|
|
37
|
+
const div = (x, y) => fromNumber(Math.floor(x / y));
|
|
38
|
+
const random = (min, max) => asUint8(randomImpl(castTypeImpl(min), castTypeImpl(max)));
|
|
44
39
|
|
|
45
40
|
|
|
46
41
|
|
|
@@ -55,7 +50,7 @@ export const Uint8 = {
|
|
|
55
50
|
|
|
56
51
|
|
|
57
52
|
|
|
58
|
-
is,
|
|
53
|
+
is: isUint8,
|
|
59
54
|
|
|
60
55
|
|
|
61
56
|
|