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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"positive-int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int16.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,iCAAiC,CAAC;AAOzC,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAA0B,EAAE,CACvE,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,eAAe,GAAG,CAC7B,KAAQ,EACW,EAAE;IACrB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE,EAAE,eAAe;IAEnB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;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 PositiveInt32 = TtfImported_PositiveInt32;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isPositiveInt32: (
|
|
12
|
+
export declare const isPositiveInt32: (value: number) => value is PositiveInt32;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `PositiveInt32` branded type.
|
|
15
15
|
*
|
|
@@ -20,23 +20,7 @@ export declare const isPositiveInt32: (a: number) => a is TtfImported_PositiveIn
|
|
|
20
20
|
* @returns The value as a `PositiveInt32`
|
|
21
21
|
* @throws {TypeError} If the value is not a positive integer in [1, 2^31)
|
|
22
22
|
*/
|
|
23
|
-
export declare const asPositiveInt32: <N extends number>(
|
|
24
|
-
readonly "!=0": true;
|
|
25
|
-
readonly "< 2^31": true;
|
|
26
|
-
readonly "< 2^32": true;
|
|
27
|
-
readonly "<=0": false;
|
|
28
|
-
readonly "> -2^16": true;
|
|
29
|
-
readonly "> -2^32": true;
|
|
30
|
-
readonly ">= -2^15": true;
|
|
31
|
-
readonly ">= -2^31": true;
|
|
32
|
-
readonly ">=0": true;
|
|
33
|
-
readonly Finite: true;
|
|
34
|
-
readonly Int: true;
|
|
35
|
-
readonly NaNValue: false;
|
|
36
|
-
readonly SafeInt: true;
|
|
37
|
-
} & Readonly<{
|
|
38
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
39
|
-
}> & N;
|
|
23
|
+
export declare const asPositiveInt32: <N extends number>(value: N) => PositiveInt32 & N;
|
|
40
24
|
/**
|
|
41
25
|
* Namespace providing type-safe operations for the `PositiveInt32` branded
|
|
42
26
|
* type.
|
|
@@ -52,7 +36,7 @@ export declare const PositiveInt32: {
|
|
|
52
36
|
* @returns `true` if the value is a positive integer in [1, 2^31), `false` otherwise
|
|
53
37
|
* @see {@link isPositiveInt32} for usage examples
|
|
54
38
|
*/
|
|
55
|
-
readonly is:
|
|
39
|
+
readonly is: typeof isPositiveInt32;
|
|
56
40
|
/**
|
|
57
41
|
* The smallest value representable as `PositiveInt32` (the lower saturation
|
|
58
42
|
* target of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"positive-int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAiBhF,MAAM,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAMtD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,KAAK,IAAI,aACU,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,SACvC,CAAC,KACP,aAAa,GAAG,CAMlB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;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/positive-int32.mjs';
|
|
3
3
|
const typeNameInMessage = 'a positive integer in [1, 2^31)';
|
|
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: 1,
|
|
7
|
-
MAX_VALUE: 2 ** 31 - 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 isPositiveInt32 =
|
|
13
|
+
export const isPositiveInt32 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 31 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isPositiveInt32 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asPositiveInt32 =
|
|
24
|
+
export const asPositiveInt32 = (value) => {
|
|
25
|
+
if (!isPositiveInt32(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
@@ -43,7 +42,7 @@ export const PositiveInt32 = {
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
is,
|
|
45
|
+
is: isPositiveInt32,
|
|
47
46
|
|
|
48
47
|
|
|
49
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"positive-int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-int32.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,iCAAiC,CAAC;AAOzC,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAA0B,EAAE,CACvE,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,eAAe,GAAG,CAC7B,KAAQ,EACW,EAAE;IACrB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;;;;OAMG;IACH,EAAE,EAAE,eAAe;IAEnB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;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,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PositiveSafeInt as TtfImported_PositiveSafeInt } from 'ts-type-forge';
|
|
2
2
|
export type PositiveSafeInt = TtfImported_PositiveSafeInt;
|
|
3
3
|
/**
|
|
4
4
|
* Type guard that checks if a value is a positive safe integer.
|
|
@@ -21,7 +21,7 @@ export type PositiveSafeInt = TtfImported_PositiveSafeInt;
|
|
|
21
21
|
* @param value - The value to check
|
|
22
22
|
* @returns `true` if the value is a positive safe integer, `false` otherwise
|
|
23
23
|
*/
|
|
24
|
-
export declare const isPositiveSafeInt: (
|
|
24
|
+
export declare const isPositiveSafeInt: (value: number) => value is PositiveSafeInt;
|
|
25
25
|
/**
|
|
26
26
|
* Casts a `number` to the `PositiveSafeInt` branded type.
|
|
27
27
|
*
|
|
@@ -42,21 +42,7 @@ export declare const isPositiveSafeInt: (a: number) => a is TtfImported_Positive
|
|
|
42
42
|
* @returns The value as a `PositiveSafeInt`
|
|
43
43
|
* @throws {TypeError} If the value is not a positive safe integer
|
|
44
44
|
*/
|
|
45
|
-
export declare const asPositiveSafeInt: <N extends number>(
|
|
46
|
-
readonly "!=0": true;
|
|
47
|
-
readonly "<=0": false;
|
|
48
|
-
readonly "> -2^16": true;
|
|
49
|
-
readonly "> -2^32": true;
|
|
50
|
-
readonly ">= -2^15": true;
|
|
51
|
-
readonly ">= -2^31": true;
|
|
52
|
-
readonly ">=0": true;
|
|
53
|
-
readonly Finite: true;
|
|
54
|
-
readonly Int: true;
|
|
55
|
-
readonly NaNValue: false;
|
|
56
|
-
readonly SafeInt: true;
|
|
57
|
-
} & Readonly<{
|
|
58
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
59
|
-
}> & N;
|
|
45
|
+
export declare const asPositiveSafeInt: <N extends number>(value: N) => PositiveSafeInt & N;
|
|
60
46
|
/**
|
|
61
47
|
* Namespace providing type-safe operations for the `PositiveSafeInt` branded
|
|
62
48
|
* type.
|
|
@@ -84,7 +70,7 @@ export declare const PositiveSafeInt: {
|
|
|
84
70
|
* @returns `true` if the value is a positive safe integer, `false` otherwise
|
|
85
71
|
* @see {@link isPositiveSafeInt} for usage examples
|
|
86
72
|
*/
|
|
87
|
-
readonly is:
|
|
73
|
+
readonly is: typeof isPositiveSafeInt;
|
|
88
74
|
/**
|
|
89
75
|
* The smallest value representable as `PositiveSafeInt` (the lower saturation
|
|
90
76
|
* target of `fromNumber`).
|
|
@@ -94,7 +80,7 @@ export declare const PositiveSafeInt: {
|
|
|
94
80
|
* The largest value representable as `PositiveSafeInt` (the upper saturation
|
|
95
81
|
* target of `fromNumber`).
|
|
96
82
|
*/
|
|
97
|
-
readonly MAX_VALUE: SafeUint;
|
|
83
|
+
readonly MAX_VALUE: import("ts-type-forge").SafeUint;
|
|
98
84
|
/**
|
|
99
85
|
* Returns the smallest of the given positive safe integers.
|
|
100
86
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"positive-safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAiBpF,MAAM,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAM1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,KAAG,KAAK,IAAI,eAChB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,SACzC,CAAC,KACP,eAAe,GAAG,CAMpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;OAoBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;;;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -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/positive-safe-int.mjs';
|
|
3
3
|
const typeNameInMessage = 'a positive 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: 1,
|
|
7
4
|
|
|
8
|
-
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
9
|
-
typeNameInMessage,
|
|
10
|
-
});
|
|
11
5
|
|
|
12
6
|
|
|
13
7
|
|
|
@@ -28,8 +22,8 @@ const { MAX_VALUE, MIN_VALUE, add, castType, div, fromNumber, is, max: max_, min
|
|
|
28
22
|
|
|
29
23
|
|
|
30
24
|
|
|
25
|
+
export const isPositiveSafeInt = (value) => Number.isSafeInteger(value) && value >= 1;
|
|
31
26
|
|
|
32
|
-
export const isPositiveSafeInt = is;
|
|
33
27
|
|
|
34
28
|
|
|
35
29
|
|
|
@@ -49,8 +43,12 @@ export const isPositiveSafeInt = is;
|
|
|
49
43
|
|
|
50
44
|
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
export const asPositiveSafeInt = (value) => {
|
|
47
|
+
if (!isPositiveSafeInt(value)) {
|
|
48
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
};
|
|
54
52
|
|
|
55
53
|
|
|
56
54
|
|
|
@@ -78,7 +76,7 @@ export const PositiveSafeInt = {
|
|
|
78
76
|
|
|
79
77
|
|
|
80
78
|
|
|
81
|
-
is,
|
|
79
|
+
is: isPositiveSafeInt,
|
|
82
80
|
|
|
83
81
|
|
|
84
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"positive-safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-safe-int.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,oCAAoC,CAAC;AAO5C,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAA4B,EAAE,CAC3E,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAQ,EACa,EAAE;IACvB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;;;;;;;;;;;;;;;;;OAkBG;IACH,EAAE,EAAE,iBAAiB;IAErB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,UAAU;IAEV;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM;IAEN;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type PositiveUint16 = TtfImported_PositiveUint16;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a positive integer in [1, 2^16), `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isPositiveUint16: (
|
|
12
|
+
export declare const isPositiveUint16: (value: number) => value is PositiveUint16;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `PositiveUint16` branded type.
|
|
15
15
|
*
|
|
@@ -20,24 +20,7 @@ export declare const isPositiveUint16: (a: number) => a is TtfImported_PositiveU
|
|
|
20
20
|
* @returns The value as a `PositiveUint16`
|
|
21
21
|
* @throws {TypeError} If the value is not a positive integer in [1, 2^16)
|
|
22
22
|
*/
|
|
23
|
-
export declare const asPositiveUint16: <N extends number>(
|
|
24
|
-
readonly "!=0": true;
|
|
25
|
-
readonly "< 2^16": true;
|
|
26
|
-
readonly "< 2^31": true;
|
|
27
|
-
readonly "< 2^32": true;
|
|
28
|
-
readonly "<=0": false;
|
|
29
|
-
readonly "> -2^16": true;
|
|
30
|
-
readonly "> -2^32": true;
|
|
31
|
-
readonly ">= -2^15": true;
|
|
32
|
-
readonly ">= -2^31": true;
|
|
33
|
-
readonly ">=0": true;
|
|
34
|
-
readonly Finite: true;
|
|
35
|
-
readonly Int: true;
|
|
36
|
-
readonly NaNValue: false;
|
|
37
|
-
readonly SafeInt: true;
|
|
38
|
-
} & Readonly<{
|
|
39
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
40
|
-
}> & N;
|
|
23
|
+
export declare const asPositiveUint16: <N extends number>(value: N) => PositiveUint16 & N;
|
|
41
24
|
/**
|
|
42
25
|
* Namespace providing type-safe operations for the `PositiveUint16` branded
|
|
43
26
|
* type.
|
|
@@ -53,7 +36,7 @@ export declare const PositiveUint16: {
|
|
|
53
36
|
* @returns `true` if the value is a positive integer in [1, 2^16), `false` otherwise
|
|
54
37
|
* @see {@link isPositiveUint16} for usage examples
|
|
55
38
|
*/
|
|
56
|
-
readonly is:
|
|
39
|
+
readonly is: typeof isPositiveUint16;
|
|
57
40
|
/**
|
|
58
41
|
* The smallest value representable as `PositiveUint16` (the lower saturation
|
|
59
42
|
* target of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"positive-uint16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAiBlF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAMxD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,KAAK,IAAI,cACS,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,SACxC,CAAC,KACP,cAAc,GAAG,CAMnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;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/positive-uint16.mjs';
|
|
3
3
|
const typeNameInMessage = 'a positive integer in [1, 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: 1,
|
|
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 isPositiveUint16 =
|
|
13
|
+
export const isPositiveUint16 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 16 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isPositiveUint16 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asPositiveUint16 =
|
|
24
|
+
export const asPositiveUint16 = (value) => {
|
|
25
|
+
if (!isPositiveUint16(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
@@ -43,7 +42,7 @@ export const PositiveUint16 = {
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
is,
|
|
45
|
+
is: isPositiveUint16,
|
|
47
46
|
|
|
48
47
|
|
|
49
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"positive-uint16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-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,kCAAkC,CAAC;AAO1C,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA2B,EAAE,CACzE,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,gBAAgB,GAAG,CAC9B,KAAQ,EACY,EAAE;IACtB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE,EAAE,gBAAgB;IAEpB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;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 PositiveUint32 = TtfImported_PositiveUint32;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a positive integer in [1, 2^32), `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isPositiveUint32: (
|
|
12
|
+
export declare const isPositiveUint32: (value: number) => value is PositiveUint32;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `PositiveUint32` branded type.
|
|
15
15
|
*
|
|
@@ -20,22 +20,7 @@ export declare const isPositiveUint32: (a: number) => a is TtfImported_PositiveU
|
|
|
20
20
|
* @returns The value as a `PositiveUint32`
|
|
21
21
|
* @throws {TypeError} If the value is not a positive integer in [1, 2^32)
|
|
22
22
|
*/
|
|
23
|
-
export declare const asPositiveUint32: <N extends number>(
|
|
24
|
-
readonly "!=0": true;
|
|
25
|
-
readonly "< 2^32": true;
|
|
26
|
-
readonly "<=0": false;
|
|
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 asPositiveUint32: <N extends number>(value: N) => PositiveUint32 & N;
|
|
39
24
|
/**
|
|
40
25
|
* Namespace providing type-safe operations for the `PositiveUint32` branded
|
|
41
26
|
* type.
|
|
@@ -51,7 +36,7 @@ export declare const PositiveUint32: {
|
|
|
51
36
|
* @returns `true` if the value is a positive integer in [1, 2^32), `false` otherwise
|
|
52
37
|
* @see {@link isPositiveUint32} for usage examples
|
|
53
38
|
*/
|
|
54
|
-
readonly is:
|
|
39
|
+
readonly is: typeof isPositiveUint32;
|
|
55
40
|
/**
|
|
56
41
|
* The smallest value representable as `PositiveUint32` (the lower saturation
|
|
57
42
|
* target of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"positive-uint32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAiBlF,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAMxD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,KAAK,IAAI,cACS,CAAC;AAEpE;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,SACxC,CAAC,KACP,cAAc,GAAG,CAMnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;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/positive-uint32.mjs';
|
|
3
3
|
const typeNameInMessage = 'a positive integer in [1, 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: 1,
|
|
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 isPositiveUint32 =
|
|
13
|
+
export const isPositiveUint32 = (value) => Number.isSafeInteger(value) && 1 <= value && value <= 2 ** 32 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isPositiveUint32 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asPositiveUint32 =
|
|
24
|
+
export const asPositiveUint32 = (value) => {
|
|
25
|
+
if (!isPositiveUint32(value)) {
|
|
26
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
@@ -43,7 +42,7 @@ export const PositiveUint32 = {
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
is,
|
|
45
|
+
is: isPositiveUint32,
|
|
47
46
|
|
|
48
47
|
|
|
49
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-uint32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"positive-uint32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/positive-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,kCAAkC,CAAC;AAO1C,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA2B,EAAE,CACzE,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,gBAAgB,GAAG,CAC9B,KAAQ,EACY,EAAE;IACtB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;;;;;OAMG;IACH,EAAE,EAAE,gBAAgB;IAEpB;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;OAUG;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,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SafeInt as TtfImported_SafeInt } from 'ts-type-forge';
|
|
2
2
|
export type SafeInt = TtfImported_SafeInt;
|
|
3
3
|
/**
|
|
4
4
|
* Type guard that checks if a value is a safe integer.
|
|
@@ -18,7 +18,7 @@ export type SafeInt = TtfImported_SafeInt;
|
|
|
18
18
|
* @param value - The value to check
|
|
19
19
|
* @returns `true` if the value is a safe integer, `false` otherwise
|
|
20
20
|
*/
|
|
21
|
-
export declare const isSafeInt: (
|
|
21
|
+
export declare const isSafeInt: (value: number) => value is SafeInt;
|
|
22
22
|
/**
|
|
23
23
|
* Casts a `number` to the `SafeInt` branded type.
|
|
24
24
|
*
|
|
@@ -39,14 +39,7 @@ export declare const isSafeInt: (a: number) => a is TtfImported_SafeInt;
|
|
|
39
39
|
* @returns The value as a `SafeInt`
|
|
40
40
|
* @throws {TypeError} If the value is not a safe integer
|
|
41
41
|
*/
|
|
42
|
-
export declare const asSafeInt: <N extends number>(
|
|
43
|
-
readonly Finite: true;
|
|
44
|
-
readonly Int: true;
|
|
45
|
-
readonly NaNValue: false;
|
|
46
|
-
readonly SafeInt: true;
|
|
47
|
-
} & Readonly<{
|
|
48
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
49
|
-
}> & N;
|
|
42
|
+
export declare const asSafeInt: <N extends number>(value: N) => SafeInt & N;
|
|
50
43
|
/**
|
|
51
44
|
* Namespace providing type-safe operations for the `SafeInt` branded type.
|
|
52
45
|
*
|
|
@@ -71,7 +64,7 @@ export declare const SafeInt: {
|
|
|
71
64
|
* @returns `true` if the value is a safe integer, `false` otherwise
|
|
72
65
|
* @see {@link isSafeInt} for usage examples
|
|
73
66
|
*/
|
|
74
|
-
readonly is:
|
|
67
|
+
readonly is: typeof isSafeInt;
|
|
75
68
|
/**
|
|
76
69
|
* The smallest value representable as `SafeInt` (the lower saturation target
|
|
77
70
|
* of `fromNumber`).
|
|
@@ -81,7 +74,7 @@ export declare const SafeInt: {
|
|
|
81
74
|
* The largest value representable as `SafeInt` (the upper saturation target
|
|
82
75
|
* of `fromNumber`).
|
|
83
76
|
*/
|
|
84
|
-
readonly MAX_VALUE: SafeUint;
|
|
77
|
+
readonly MAX_VALUE: import("ts-type-forge").SafeUint;
|
|
85
78
|
/**
|
|
86
79
|
* Returns the absolute value of a safe integer.
|
|
87
80
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"safe-int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAkBpE,MAAM,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAM1C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,KAAK,IAAI,OACtB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,OAAO,GAAG,CAMhE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;OAiBG;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_VALUE, MIN_VALUE, abs, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/safe-int.mjs';
|
|
3
3
|
const typeNameInMessage = 'a safe integer';
|
|
4
|
-
const { MAX_VALUE, MIN_VALUE, abs, add, castType, div, fromNumber, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'SafeInteger',
|
|
6
4
|
|
|
7
|
-
MIN_VALUE: Number.MIN_SAFE_INTEGER,
|
|
8
5
|
|
|
9
|
-
MAX_VALUE: Number.MAX_SAFE_INTEGER,
|
|
10
|
-
typeNameInMessage,
|
|
11
|
-
});
|
|
12
6
|
|
|
13
7
|
|
|
14
8
|
|
|
@@ -25,9 +19,9 @@ const { MAX_VALUE, MIN_VALUE, abs, add, castType, div, fromNumber, is, max: max_
|
|
|
25
19
|
|
|
26
20
|
|
|
27
21
|
|
|
22
|
+
export const isSafeInt = (value) => Number.isSafeInteger(value);
|
|
28
23
|
|
|
29
24
|
|
|
30
|
-
export const isSafeInt = is;
|
|
31
25
|
|
|
32
26
|
|
|
33
27
|
|
|
@@ -46,9 +40,12 @@ export const isSafeInt = is;
|
|
|
46
40
|
|
|
47
41
|
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
export const asSafeInt = (value) => {
|
|
44
|
+
if (!isSafeInt(value)) {
|
|
45
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
52
49
|
|
|
53
50
|
|
|
54
51
|
|
|
@@ -73,7 +70,7 @@ export const SafeInt = {
|
|
|
73
70
|
|
|
74
71
|
|
|
75
72
|
|
|
76
|
-
is,
|
|
73
|
+
is: isSafeInt,
|
|
77
74
|
|
|
78
75
|
|
|
79
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"safe-int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/safe-int.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,GAAG,EACH,UAAU,EACV,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,2BAA2B,CAAC;AAOnC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAoB,EAAE,CAC3D,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAmB,KAAQ,EAAe,EAAE;IACnE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,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,OAAO,GAAG;IACrB;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,EAAE,SAAS;IAEb;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;IAEH;;;;;;;;;;;;;OAaG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;OAaG;IACH,GAAG,EAAE,IAAI;IAET;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU;IAEV;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM;IAEN;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type SafeUint = TtfImported_SafeUint;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is a non-negative safe integer, `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isSafeUint: (
|
|
12
|
+
export declare const isSafeUint: (value: number) => value is SafeUint;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `SafeUint` branded type.
|
|
15
15
|
*
|
|
@@ -20,19 +20,7 @@ export declare const isSafeUint: (a: number) => a is TtfImported_SafeUint;
|
|
|
20
20
|
* @returns The value as a `SafeUint`
|
|
21
21
|
* @throws {TypeError} If the value is not a non-negative safe integer
|
|
22
22
|
*/
|
|
23
|
-
export declare const asSafeUint: <N extends number>(
|
|
24
|
-
readonly "> -2^16": true;
|
|
25
|
-
readonly "> -2^32": true;
|
|
26
|
-
readonly ">= -2^15": true;
|
|
27
|
-
readonly ">= -2^31": true;
|
|
28
|
-
readonly ">=0": true;
|
|
29
|
-
readonly Finite: true;
|
|
30
|
-
readonly Int: true;
|
|
31
|
-
readonly NaNValue: false;
|
|
32
|
-
readonly SafeInt: true;
|
|
33
|
-
} & Readonly<{
|
|
34
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
35
|
-
}> & N;
|
|
23
|
+
export declare const asSafeUint: <N extends number>(value: N) => SafeUint & N;
|
|
36
24
|
/**
|
|
37
25
|
* Namespace providing type-safe operations for the `SafeUint` branded type.
|
|
38
26
|
*
|
|
@@ -47,7 +35,7 @@ export declare const SafeUint: {
|
|
|
47
35
|
* @returns `true` if the value is a non-negative safe integer, `false` otherwise
|
|
48
36
|
* @see {@link isSafeUint} for usage examples
|
|
49
37
|
*/
|
|
50
|
-
readonly is:
|
|
38
|
+
readonly is: typeof isSafeUint;
|
|
51
39
|
/**
|
|
52
40
|
* The smallest value representable as `SafeUint` (the lower saturation target
|
|
53
41
|
* of `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-uint.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"safe-uint.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/safe-uint.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAiBtE,MAAM,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAM5C;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,KAAK,IAAI,QACT,CAAC;AAE5C;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,QAAQ,GAAG,CAMlE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;;CAEK,CAAC"}
|