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
package/dist/iterator/range.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asSafeInt } from '../number/index.mjs';
|
|
2
|
+
import * as Num from '../number/num/impl/index.mjs';
|
|
2
3
|
export function* range(...args) {
|
|
3
4
|
switch (args.length) {
|
|
4
5
|
case 1: {
|
|
@@ -12,7 +13,9 @@ export function* range(...args) {
|
|
|
12
13
|
|
|
13
14
|
case 3: {
|
|
14
15
|
const [start, end, step = 1] = args;
|
|
15
|
-
for (let mut_i = asSafeInt(start); step > 0 ? mut_i < end : mut_i > end;
|
|
16
|
+
for (let mut_i = asSafeInt(start); step > 0 ? mut_i < end : mut_i > end;
|
|
17
|
+
|
|
18
|
+
mut_i = asSafeInt(Num.clamp(mut_i + asSafeInt(step), Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER))) {
|
|
16
19
|
yield mut_i;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range.mjs","sourceRoot":"","sources":["../../src/iterator/range.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"range.mjs","sourceRoot":"","sources":["../../src/iterator/range.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAiFpD,MAAM,SAAS,CAAC,CAAC,KAAK,CACpB,GAAG,IAME;IAEL,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;YAEnB,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;gBACjC,MAAM,CAAC,CAAC;YACV,CAAC;YAED,MAAM;QACR,CAAC;QAED,KAAK,CAAC,CAAC;QAEP,gBAAgB;QAChB,KAAK,CAAC,EAAE,CAAC;YACP,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YAEpC,KACE,IAAI,KAAK,GAAY,SAAS,CAAC,KAAK,CAAC,EACrC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG;YACpC,iEAAiE;YACjE,KAAK,GAAG,SAAS,CACf,GAAG,CAAC,KAAK,CACP,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,EACvB,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,gBAAgB,CACxB,CACF,EACD,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/json/json.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.mts","sourceRoot":"","sources":["../../src/json/json.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,aAAa,EACd,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"json.d.mts","sourceRoot":"","sources":["../../src/json/json.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAIjD;;;;GAIG;AACH,yBAAiB,IAAI,CAAC;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACI,MAAM,KAAK,SACV,MAAM,YACF,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,OAAO,KAClE,MAAM,CAAC,SAAS,EAAE,MAAM,CAc1B,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgEG;IACI,MAAM,SAAS,UACb,OAAO,aACH,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,UACxD,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,KACzC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAQnC,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgEG;IACI,MAAM,iBAAiB,UACrB,OAAO,2BACW,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,UAC7C,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,KACzC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAUnC,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4EG;IACI,MAAM,kBAAkB,UACtB,aAAa,UACZ,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,KACzC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAoBnC,CAAC;CACH"}
|
package/dist/json/json.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pipe, Result } from '../functional/index.mjs';
|
|
1
|
+
import { Result } from '../functional/index.mjs';
|
|
3
2
|
import { isRecord } from '../guard/index.mjs';
|
|
4
3
|
import { unknownToString } from '../others/index.mjs';
|
|
5
4
|
|
|
@@ -295,55 +294,22 @@ export var Json;
|
|
|
295
294
|
|
|
296
295
|
|
|
297
296
|
Json.stringifySortedKey = (value, space) => {
|
|
298
|
-
const allKeys = pipe(keysDeep(value))
|
|
299
|
-
.map(Arr.uniq)
|
|
300
|
-
.map((ks) => ks.toSorted()).value;
|
|
301
|
-
return Json.stringifySelected(value, allKeys, space);
|
|
302
|
-
};
|
|
303
|
-
})(Json || (Json = {}));
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
297
|
|
|
310
298
|
|
|
311
299
|
|
|
312
300
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
mut_keys)
|
|
318
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
319
|
-
mut_keys.push(k);
|
|
320
|
-
if (isRecord(v)) {
|
|
321
|
-
keysDeepImpl(v, mut_keys);
|
|
322
|
-
}
|
|
323
|
-
if (Array.isArray(v)) {
|
|
324
|
-
for (const li of v) {
|
|
325
|
-
if (isRecord(li)) {
|
|
326
|
-
keysDeepImpl(li, mut_keys);
|
|
301
|
+
const mut_keys = new Set();
|
|
302
|
+
const collected = Json.stringify(value, (_key, v) => {
|
|
303
|
+
if (isRecord(v)) {
|
|
304
|
+
for (const k of Object.keys(v)) {
|
|
305
|
+
mut_keys.add(k);
|
|
327
306
|
}
|
|
328
307
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const keysDeep = (obj) => {
|
|
345
|
-
const mut_keys = [];
|
|
346
|
-
keysDeepImpl(obj, mut_keys);
|
|
347
|
-
return mut_keys;
|
|
348
|
-
};
|
|
308
|
+
return v;
|
|
309
|
+
});
|
|
310
|
+
return Result.isErr(collected)
|
|
311
|
+
? collected
|
|
312
|
+
: Json.stringifySelected(value, Array.from(mut_keys).toSorted(), space);
|
|
313
|
+
};
|
|
314
|
+
})(Json || (Json = {}));
|
|
349
315
|
//# sourceMappingURL=json.mjs.map
|
package/dist/json/json.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.mjs","sourceRoot":"","sources":["../../src/json/json.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"json.mjs","sourceRoot":"","sources":["../../src/json/json.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,M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umber } from 'ts-type-forge';
|
|
2
|
-
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
|
+
import type { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
3
|
export type FiniteNumber = TtfImported_FiniteNumber;
|
|
4
4
|
type ElementType = FiniteNumber;
|
|
5
5
|
declare const floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
@@ -14,7 +14,7 @@ declare const round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils
|
|
|
14
14
|
* @param value - The value to check
|
|
15
15
|
* @returns `true` if the value is a finite number, `false` otherwise
|
|
16
16
|
*/
|
|
17
|
-
export declare const isFiniteNumber: (
|
|
17
|
+
export declare const isFiniteNumber: (value: number) => value is FiniteNumber;
|
|
18
18
|
/**
|
|
19
19
|
* Casts a `number` to the `FiniteNumber` branded type.
|
|
20
20
|
*
|
|
@@ -25,12 +25,7 @@ export declare const isFiniteNumber: (a: number) => a is TtfImported_FiniteNumbe
|
|
|
25
25
|
* @returns The value as a `FiniteNumber`
|
|
26
26
|
* @throws {TypeError} If the value is not a finite number
|
|
27
27
|
*/
|
|
28
|
-
export declare const asFiniteNumber: <N extends number>(
|
|
29
|
-
readonly Finite: true;
|
|
30
|
-
readonly NaNValue: false;
|
|
31
|
-
} & Readonly<{
|
|
32
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
33
|
-
}> & N;
|
|
28
|
+
export declare const asFiniteNumber: <N extends number>(value: N) => FiniteNumber & N;
|
|
34
29
|
/**
|
|
35
30
|
* Namespace providing type-safe operations for the `FiniteNumber` branded type.
|
|
36
31
|
*
|
|
@@ -44,7 +39,7 @@ export declare const FiniteNumber: {
|
|
|
44
39
|
* @returns `true` if the value is a finite number, `false` otherwise
|
|
45
40
|
* @see {@link isFiniteNumber} for usage examples
|
|
46
41
|
*/
|
|
47
|
-
readonly is:
|
|
42
|
+
readonly is: typeof isFiniteNumber;
|
|
48
43
|
/**
|
|
49
44
|
* Returns the absolute value of a finite number.
|
|
50
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,YAAY,IAAI,wBAAwB,EACzC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,YAAY,IAAI,wBAAwB,EACzC,MAAM,eAAe,CAAC;AAavB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAEpD,KAAK,WAAW,GAAG,YAAY,CAAC;AAIhC,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEiB,CAAC;AAE9E,QAAA,MAAM,IAAI,MACL,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEgB,CAAC;AAE7E,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEiB,CAAC;AAM9E;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,KAAK,IAAI,YAChC,CAAC;AAEzB;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,SACtC,CAAC,KACP,YAAY,GAAG,CAMjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { abs, add, div, max as max_, min as min_, mul, pow, random, sub, } from '../operators/finite-number.mjs';
|
|
3
3
|
const typeNameInMessage = 'a finite number';
|
|
4
|
-
const { abs, add, castType, div, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
|
|
5
|
-
MIN_VALUE: -Number.MAX_VALUE,
|
|
6
|
-
MAX_VALUE: Number.MAX_VALUE,
|
|
7
|
-
typeNameInMessage,
|
|
8
|
-
});
|
|
9
4
|
const floor = (x) =>
|
|
10
5
|
|
|
11
6
|
Math.floor(x);
|
|
@@ -25,7 +20,7 @@ Math.round(x);
|
|
|
25
20
|
|
|
26
21
|
|
|
27
22
|
|
|
28
|
-
export const isFiniteNumber =
|
|
23
|
+
export const isFiniteNumber = (value) => Number.isFinite(value);
|
|
29
24
|
|
|
30
25
|
|
|
31
26
|
|
|
@@ -36,7 +31,12 @@ export const isFiniteNumber = is;
|
|
|
36
31
|
|
|
37
32
|
|
|
38
33
|
|
|
39
|
-
export const asFiniteNumber =
|
|
34
|
+
export const asFiniteNumber = (value) => {
|
|
35
|
+
if (!isFiniteNumber(value)) {
|
|
36
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -50,7 +50,7 @@ export const FiniteNumber = {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
is,
|
|
53
|
+
is: isFiniteNumber,
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/finite-number.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"finite-number.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/finite-number.mts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,GAAG,EACH,GAAG,EACH,MAAM,EACN,GAAG,GACJ,MAAM,gCAAgC,CAAC;AAOxC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,MAAM,IAAI,GAAG,CACX,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,IAAI,CAAC,CAAC,CAA+D,CAAC;AAE7E,MAAM,KAAK,GAAG,CACZ,CAAc,EAC8C,EAAE;AAC9D,oEAAoE;AACpE,IAAI,CAAC,KAAK,CAAC,CAAC,CAA+D,CAAC;AAE9E,UAAU,CACR,GAAG,CACJ,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAyB,EAAE,CACrE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEzB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAQ,EACU,EAAE;IACpB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,YAAY,iBAAiB,UAAU,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;;;;;;OAMG;IACH,EAAE,EAAE,cAAc;IAElB;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,GAAG,EAAE,IAAI;IAET;;;;;OAKG;IACH,KAAK;IAEL;;;;;OAKG;IACH,IAAI;IAEJ;;;;;OAKG;IACH,KAAK;IAEL;;;;;;;;OAQG;IACH,MAAM;IAEN;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;IAEH;;;;;;OAMG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
|
|
@@ -19,7 +19,7 @@ export type Int = TtfImported_Int;
|
|
|
19
19
|
* @param value - The value to check
|
|
20
20
|
* @returns `true` if the value is an integer, `false` otherwise
|
|
21
21
|
*/
|
|
22
|
-
export declare const isInt: (
|
|
22
|
+
export declare const isInt: (value: number) => value is Int;
|
|
23
23
|
/**
|
|
24
24
|
* Casts a `number` to the `Int` branded type.
|
|
25
25
|
*
|
|
@@ -40,13 +40,7 @@ export declare const isInt: (a: number) => a is TtfImported_Int;
|
|
|
40
40
|
* @returns The value as an `Int`
|
|
41
41
|
* @throws {TypeError} If the value is not an integer
|
|
42
42
|
*/
|
|
43
|
-
export declare const asInt: <N extends number>(
|
|
44
|
-
readonly Finite: true;
|
|
45
|
-
readonly Int: true;
|
|
46
|
-
readonly NaNValue: false;
|
|
47
|
-
} & Readonly<{
|
|
48
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
49
|
-
}> & N;
|
|
43
|
+
export declare const asInt: <N extends number>(value: N) => Int & N;
|
|
50
44
|
/**
|
|
51
45
|
* Namespace providing type-safe operations for the `Int` branded type.
|
|
52
46
|
*
|
|
@@ -74,7 +68,7 @@ export declare const Int: {
|
|
|
74
68
|
* @returns `true` if the value is an integer, `false` otherwise
|
|
75
69
|
* @see {@link isInt} for usage examples
|
|
76
70
|
*/
|
|
77
|
-
readonly is:
|
|
71
|
+
readonly is: typeof isInt;
|
|
78
72
|
/**
|
|
79
73
|
* Returns the absolute value of an integer.
|
|
80
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAe5D,MAAM,MAAM,GAAG,GAAG,eAAe,CAAC;AAMlC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,UAAW,MAAM,KAAG,KAAK,IAAI,GAA8B,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,GAAG,GAAG,CAMxD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,GAAG;IACd;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { abs, add, div, max as max_, min as min_, mul, pow, random, sub, } from '../operators/int.mjs';
|
|
3
3
|
const typeNameInMessage = 'an integer';
|
|
4
|
-
const { abs, add, castType, div, is, max: max_, min: min_, mul, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForInteger({
|
|
5
|
-
integerOrSafeInteger: 'Integer',
|
|
6
|
-
MIN_VALUE: -Number.MAX_VALUE,
|
|
7
|
-
MAX_VALUE: Number.MAX_VALUE,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -26,7 +20,7 @@ const { abs, add, castType, div, is, max: max_, min: min_, mul, pow, random, sub
|
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
|
|
29
|
-
export const isInt =
|
|
23
|
+
export const isInt = (value) => Number.isInteger(value);
|
|
30
24
|
|
|
31
25
|
|
|
32
26
|
|
|
@@ -47,7 +41,12 @@ export const isInt = is;
|
|
|
47
41
|
|
|
48
42
|
|
|
49
43
|
|
|
50
|
-
export const asInt =
|
|
44
|
+
export const asInt = (value) => {
|
|
45
|
+
if (!isInt(value)) {
|
|
46
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
51
50
|
|
|
52
51
|
|
|
53
52
|
|
|
@@ -75,7 +74,7 @@ export const Int = {
|
|
|
75
74
|
|
|
76
75
|
|
|
77
76
|
|
|
78
|
-
is,
|
|
77
|
+
is: isInt,
|
|
79
78
|
|
|
80
79
|
|
|
81
80
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AACA,O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G;IAEH;;;;;;;;;;;;;;OAcG;IACH,GAAG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAGR,GAAG,CAAC,CAAC;AAEP,UAAU,CAGR,IAAI,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ export type Int16 = TtfImported_Int16;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is an integer in [-2^15, 2^15), `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isInt16: (
|
|
12
|
+
export declare const isInt16: (value: number) => value is Int16;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `Int16` branded type.
|
|
15
15
|
*
|
|
@@ -20,22 +20,7 @@ export declare const isInt16: (a: number) => a is TtfImported_Int16;
|
|
|
20
20
|
* @returns The value as an `Int16`
|
|
21
21
|
* @throws {TypeError} If the value is not an integer in [-2^15, 2^15)
|
|
22
22
|
*/
|
|
23
|
-
export declare const asInt16: <N extends number>(
|
|
24
|
-
readonly "< 2^15": true;
|
|
25
|
-
readonly "< 2^16": true;
|
|
26
|
-
readonly "< 2^31": true;
|
|
27
|
-
readonly "< 2^32": true;
|
|
28
|
-
readonly "> -2^16": true;
|
|
29
|
-
readonly "> -2^32": true;
|
|
30
|
-
readonly ">= -2^15": true;
|
|
31
|
-
readonly ">= -2^31": 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 asInt16: <N extends number>(value: N) => Int16 & N;
|
|
39
24
|
/**
|
|
40
25
|
* Namespace providing type-safe operations for the `Int16` branded type.
|
|
41
26
|
*
|
|
@@ -50,7 +35,7 @@ export declare const Int16: {
|
|
|
50
35
|
* @returns `true` if the value is an integer in [-2^15, 2^15), `false` otherwise
|
|
51
36
|
* @see {@link isInt16} for usage examples
|
|
52
37
|
*/
|
|
53
|
-
readonly is:
|
|
38
|
+
readonly is: typeof isInt16;
|
|
54
39
|
/**
|
|
55
40
|
* The smallest value representable as `Int16` (the lower saturation target of
|
|
56
41
|
* `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int16.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAkBhE,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAMtC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,KAAK,IAAI,KAC2B,CAAC;AAE7E;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,KAAK,GAAG,CAM5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;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, abs, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/int16.mjs';
|
|
3
3
|
const typeNameInMessage = 'an integer in [-2^15, 2^15)';
|
|
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
|
-
MIN_VALUE: -(2 ** 15),
|
|
7
|
-
MAX_VALUE: 2 ** 15 - 1,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -16,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, abs, add, castType, div, fromNumber, is, max: max_
|
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
19
|
-
export const isInt16 =
|
|
13
|
+
export const isInt16 = (value) => Number.isSafeInteger(value) && -(2 ** 15) <= value && value <= 2 ** 15 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isInt16 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asInt16 =
|
|
24
|
+
export const asInt16 = (value) => {
|
|
25
|
+
if (!isInt16(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 Int16 = {
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
is,
|
|
44
|
+
is: isInt16,
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/int16.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"int16.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/int16.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,wBAAwB,CAAC;AAOhC,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAkB,EAAE,CACvD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAmB,KAAQ,EAAa,EAAE;IAC/D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,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,KAAK,GAAG;IACnB;;;;;;OAMG;IACH,EAAE,EAAE,OAAO;IAEX;;;OAGG;IACH,SAAS;IAET;;;OAGG;IACH,SAAS;IAET;;;;;;;OAOG;IACH,GAAG;IAEH;;;;;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 Int32 = TtfImported_Int32;
|
|
|
9
9
|
* @param value - The value to check
|
|
10
10
|
* @returns `true` if the value is an integer in [-2^31, 2^31), `false` otherwise
|
|
11
11
|
*/
|
|
12
|
-
export declare const isInt32: (
|
|
12
|
+
export declare const isInt32: (value: number) => value is Int32;
|
|
13
13
|
/**
|
|
14
14
|
* Casts a `number` to the `Int32` branded type.
|
|
15
15
|
*
|
|
@@ -20,18 +20,7 @@ export declare const isInt32: (a: number) => a is TtfImported_Int32;
|
|
|
20
20
|
* @returns The value as an `Int32`
|
|
21
21
|
* @throws {TypeError} If the value is not an integer in [-2^31, 2^31)
|
|
22
22
|
*/
|
|
23
|
-
export declare const asInt32: <N extends number>(
|
|
24
|
-
readonly "< 2^31": true;
|
|
25
|
-
readonly "< 2^32": true;
|
|
26
|
-
readonly "> -2^32": true;
|
|
27
|
-
readonly ">= -2^31": true;
|
|
28
|
-
readonly Finite: true;
|
|
29
|
-
readonly Int: true;
|
|
30
|
-
readonly NaNValue: false;
|
|
31
|
-
readonly SafeInt: true;
|
|
32
|
-
} & Readonly<{
|
|
33
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
34
|
-
}> & N;
|
|
23
|
+
export declare const asInt32: <N extends number>(value: N) => Int32 & N;
|
|
35
24
|
/**
|
|
36
25
|
* Namespace providing type-safe operations for the `Int32` branded type.
|
|
37
26
|
*
|
|
@@ -46,7 +35,7 @@ export declare const Int32: {
|
|
|
46
35
|
* @returns `true` if the value is an integer in [-2^31, 2^31), `false` otherwise
|
|
47
36
|
* @see {@link isInt32} for usage examples
|
|
48
37
|
*/
|
|
49
|
-
readonly is:
|
|
38
|
+
readonly is: typeof isInt32;
|
|
50
39
|
/**
|
|
51
40
|
* The smallest value representable as `Int32` (the lower saturation target of
|
|
52
41
|
* `fromNumber`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAkBhE,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAMtC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,KAAK,IAAI,KAC2B,CAAC;AAE7E;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,KAAK,GAAG,CAM5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;;;OAOG;;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, abs, add, div, fromNumber, max as max_, min as min_, mul, pow, random, sub, } from '../operators/int32.mjs';
|
|
3
3
|
const typeNameInMessage = 'an integer in [-2^31, 2^31)';
|
|
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
|
-
MIN_VALUE: -(2 ** 31),
|
|
7
|
-
MAX_VALUE: 2 ** 31 - 1,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
|
|
11
5
|
|
|
12
6
|
|
|
@@ -16,7 +10,7 @@ const { MAX_VALUE, MIN_VALUE, abs, add, castType, div, fromNumber, is, max: max_
|
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
19
|
-
export const isInt32 =
|
|
13
|
+
export const isInt32 = (value) => Number.isSafeInteger(value) && -(2 ** 31) <= value && value <= 2 ** 31 - 1;
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
|
|
@@ -27,7 +21,12 @@ export const isInt32 = is;
|
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
export const asInt32 =
|
|
24
|
+
export const asInt32 = (value) => {
|
|
25
|
+
if (!isInt32(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 Int32 = {
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
is,
|
|
44
|
+
is: isInt32,
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"int32.mjs","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],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;OAOG;IACH,GAAG;CACK,CAAC;AAEX,UAAU,CAMR,GAAG,CAAC,CAAC;AAEP,UAAU,CAMR,IAAI,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NegativeFiniteNumber as TtfImported_NegativeFiniteNumber } from 'ts-type-forge';
|
|
2
|
-
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
2
|
+
import type { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
3
|
import { PositiveFiniteNumber } from './positive-finite-number.mjs';
|
|
4
4
|
export type NegativeFiniteNumber = TtfImported_NegativeFiniteNumber;
|
|
5
5
|
type ElementType = NegativeFiniteNumber;
|
|
@@ -16,7 +16,7 @@ declare const round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils
|
|
|
16
16
|
* @param value - The value to check
|
|
17
17
|
* @returns `true` if the value is a negative finite number, `false` otherwise
|
|
18
18
|
*/
|
|
19
|
-
export declare const isNegativeFiniteNumber: (
|
|
19
|
+
export declare const isNegativeFiniteNumber: (value: number) => value is NegativeFiniteNumber;
|
|
20
20
|
/**
|
|
21
21
|
* Casts a `number` to the `NegativeFiniteNumber` branded type.
|
|
22
22
|
*
|
|
@@ -27,19 +27,7 @@ export declare const isNegativeFiniteNumber: (a: number) => a is TtfImported_Neg
|
|
|
27
27
|
* @returns The value as a `NegativeFiniteNumber`
|
|
28
28
|
* @throws {TypeError} If the value is not a negative finite number
|
|
29
29
|
*/
|
|
30
|
-
export declare const asNegativeFiniteNumber: <N extends number>(
|
|
31
|
-
readonly "!=0": true;
|
|
32
|
-
readonly "< 2^15": true;
|
|
33
|
-
readonly "< 2^16": true;
|
|
34
|
-
readonly "< 2^31": true;
|
|
35
|
-
readonly "< 2^32": true;
|
|
36
|
-
readonly "<=0": true;
|
|
37
|
-
readonly ">=0": false;
|
|
38
|
-
readonly Finite: true;
|
|
39
|
-
readonly NaNValue: false;
|
|
40
|
-
} & Readonly<{
|
|
41
|
-
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
42
|
-
}> & N;
|
|
30
|
+
export declare const asNegativeFiniteNumber: <N extends number>(value: N) => NegativeFiniteNumber & N;
|
|
43
31
|
/**
|
|
44
32
|
* Namespace providing type-safe operations for the `NegativeFiniteNumber`
|
|
45
33
|
* branded type.
|
|
@@ -54,7 +42,7 @@ export declare const NegativeFiniteNumber: {
|
|
|
54
42
|
* @returns `true` if the value is a negative finite number, `false` otherwise
|
|
55
43
|
* @see {@link isNegativeFiniteNumber} for usage examples
|
|
56
44
|
*/
|
|
57
|
-
readonly is:
|
|
45
|
+
readonly is: typeof isNegativeFiniteNumber;
|
|
58
46
|
/**
|
|
59
47
|
* The largest value representable as `NegativeFiniteNumber` (the upper
|
|
60
48
|
* saturation target of `fromNumber`). The domain is open at `0` (excluded),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/negative-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,IAAI,gCAAgC,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/negative-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,IAAI,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAW9F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AAIxC,QAAA,MAAM,GAAG,MAAO,WAAW,KAAG,oBACgB,CAAC;AAE/C,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAEiB,CAAC;AAE9E,QAAA,MAAM,IAAI,MACL,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAKzD,CAAC;AAEJ,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,UAC1B,MAAM,KACZ,KAAK,IAAI,oBAC0C,CAAC;AAEvD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,MAAM,SAC9C,CAAC,KACP,oBAAoB,GAAG,CAMzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_VALUE, add, fromNumber, max as max_, min as min_, pow, random, sub, } from '../operators/negative-finite-number.mjs';
|
|
2
2
|
import { PositiveFiniteNumber } from './positive-finite-number.mjs';
|
|
3
3
|
const typeNameInMessage = 'a negative finite number';
|
|
4
|
-
const { MAX_VALUE, add, castType, fromNumber, is, max: max_, min: min_, pow, random, sub, } = TsDataForgeInternals.RefinedNumberUtils.operatorsForFloat({
|
|
5
|
-
nonZero: true,
|
|
6
|
-
MIN_VALUE: -Number.MAX_VALUE,
|
|
7
|
-
MAX_VALUE: -Number.MIN_VALUE,
|
|
8
|
-
typeNameInMessage,
|
|
9
|
-
});
|
|
10
4
|
const abs = (x) => PositiveFiniteNumber.fromNumber(Math.abs(x));
|
|
11
5
|
const floor = (x) =>
|
|
12
6
|
|
|
@@ -26,7 +20,7 @@ Math.round(x);
|
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
|
|
29
|
-
export const isNegativeFiniteNumber =
|
|
23
|
+
export const isNegativeFiniteNumber = (value) => Number.isFinite(value) && value <= -Number.MIN_VALUE;
|
|
30
24
|
|
|
31
25
|
|
|
32
26
|
|
|
@@ -37,7 +31,12 @@ export const isNegativeFiniteNumber = is;
|
|
|
37
31
|
|
|
38
32
|
|
|
39
33
|
|
|
40
|
-
export const asNegativeFiniteNumber =
|
|
34
|
+
export const asNegativeFiniteNumber = (value) => {
|
|
35
|
+
if (!isNegativeFiniteNumber(value)) {
|
|
36
|
+
throw new TypeError(`Expected ${typeNameInMessage}, got: ${value}`);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
|
|
@@ -52,7 +51,7 @@ export const NegativeFiniteNumber = {
|
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
|
|
55
|
-
is,
|
|
54
|
+
is: isNegativeFiniteNumber,
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
|