ts-data-forge 10.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/impl/array-utils-creation.d.mts +3 -3
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts +4 -4
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/{guard/as-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-cast.d.mts} +9 -9
- package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -0
- package/dist/{guard/as-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-cast.mjs} +2 -2
- package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -0
- package/dist/{guard/is-length-bounded-array.d.mts → array/impl/array-utils-length-bounded-array-guard.d.mts} +13 -13
- package/dist/array/impl/array-utils-length-bounded-array-guard.d.mts.map +1 -0
- package/dist/{guard/is-length-bounded-array.mjs → array/impl/array-utils-length-bounded-array-guard.mjs} +1 -1
- package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -0
- package/dist/array/impl/array-utils-modification.d.mts +9 -9
- package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts +9 -9
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +3 -3
- package/dist/array/impl/array-utils-size.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts +9 -9
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts +16 -10
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/index.d.mts +2 -0
- package/dist/array/impl/index.d.mts.map +1 -1
- package/dist/array/impl/index.mjs +2 -0
- package/dist/array/impl/index.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -3
- package/dist/entry-point.mjs.map +1 -1
- package/dist/guard/index.d.mts +0 -3
- package/dist/guard/index.d.mts.map +1 -1
- package/dist/guard/index.mjs +0 -3
- package/dist/guard/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.d.mts +47 -61
- package/dist/number/branded-types/finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/finite-number.mjs +37 -41
- package/dist/number/branded-types/finite-number.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +40 -46
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int.mjs +29 -31
- package/dist/number/branded-types/int.mjs.map +1 -1
- package/dist/number/branded-types/int16.d.mts +65 -58
- package/dist/number/branded-types/int16.d.mts.map +1 -1
- package/dist/number/branded-types/int16.mjs +49 -45
- package/dist/number/branded-types/int16.mjs.map +1 -1
- package/dist/number/branded-types/int32.d.mts +65 -58
- package/dist/number/branded-types/int32.d.mts.map +1 -1
- package/dist/number/branded-types/int32.mjs +49 -45
- package/dist/number/branded-types/int32.mjs.map +1 -1
- package/dist/number/branded-types/negative-finite-number.d.mts +68 -59
- package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/negative-finite-number.mjs +52 -46
- package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/negative-int.d.mts +60 -48
- package/dist/number/branded-types/negative-int.d.mts.map +1 -1
- package/dist/number/branded-types/negative-int.mjs +40 -36
- package/dist/number/branded-types/negative-int.mjs.map +1 -1
- package/dist/number/branded-types/negative-safe-int.d.mts +57 -56
- package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/negative-safe-int.mjs +40 -41
- package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.d.mts +74 -64
- package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.mjs +58 -51
- package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int16.d.mts +64 -57
- package/dist/number/branded-types/non-negative-int16.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-int16.mjs +47 -43
- package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-negative-int32.d.mts +64 -58
- package/dist/number/branded-types/non-negative-int32.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-int32.mjs +47 -44
- package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.d.mts +64 -54
- package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.mjs +48 -41
- package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-int.d.mts +41 -146
- package/dist/number/branded-types/non-positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-int.mjs +27 -107
- package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.d.mts +54 -53
- package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-safe-int.mjs +37 -39
- package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.d.mts +62 -49
- package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs +46 -37
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.d.mts +51 -38
- package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int.mjs +31 -27
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.d.mts +52 -53
- package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs +36 -39
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.d.mts +52 -54
- package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs +36 -40
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.d.mts +53 -54
- package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +36 -40
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.d.mts +52 -53
- package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs +35 -39
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.d.mts +52 -53
- package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs +35 -39
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.d.mts +74 -63
- package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/positive-finite-number.mjs +58 -50
- package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/positive-int.d.mts +46 -68
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.mjs +34 -49
- package/dist/number/branded-types/positive-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-int16.d.mts +61 -57
- package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int16.mjs +44 -43
- package/dist/number/branded-types/positive-int16.mjs.map +1 -1
- package/dist/number/branded-types/positive-int32.d.mts +61 -57
- package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int32.mjs +44 -43
- package/dist/number/branded-types/positive-int32.mjs.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +62 -57
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.mjs +45 -43
- package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint16.d.mts +61 -57
- package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint16.mjs +44 -43
- package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
- package/dist/number/branded-types/positive-uint32.d.mts +61 -58
- package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint32.mjs +44 -44
- package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +43 -62
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.mjs +35 -42
- package/dist/number/branded-types/safe-int.mjs.map +1 -1
- package/dist/number/branded-types/safe-uint.d.mts +62 -57
- package/dist/number/branded-types/safe-uint.d.mts.map +1 -1
- package/dist/number/branded-types/safe-uint.mjs +46 -44
- package/dist/number/branded-types/safe-uint.mjs.map +1 -1
- package/dist/number/branded-types/uint.d.mts +63 -50
- package/dist/number/branded-types/uint.d.mts.map +1 -1
- package/dist/number/branded-types/uint.mjs +42 -39
- package/dist/number/branded-types/uint.mjs.map +1 -1
- package/dist/number/branded-types/uint16.d.mts +60 -58
- package/dist/number/branded-types/uint16.d.mts.map +1 -1
- package/dist/number/branded-types/uint16.mjs +44 -43
- package/dist/number/branded-types/uint16.mjs.map +1 -1
- package/dist/number/branded-types/uint32.d.mts +59 -55
- package/dist/number/branded-types/uint32.d.mts.map +1 -1
- package/dist/number/branded-types/uint32.mjs +42 -42
- package/dist/number/branded-types/uint32.mjs.map +1 -1
- package/dist/number/enum/int8.d.mts +56 -65
- package/dist/number/enum/int8.d.mts.map +1 -1
- package/dist/number/enum/int8.mjs +44 -43
- package/dist/number/enum/int8.mjs.map +1 -1
- package/dist/number/enum/uint8.d.mts +60 -58
- package/dist/number/enum/uint8.d.mts.map +1 -1
- package/dist/number/enum/uint8.mjs +44 -43
- package/dist/number/enum/uint8.mjs.map +1 -1
- package/dist/string/index.d.mts +2 -0
- package/dist/string/index.d.mts.map +1 -0
- package/dist/string/index.mjs +2 -0
- package/dist/string/index.mjs.map +1 -0
- package/dist/string/str.d.mts +273 -0
- package/dist/string/str.d.mts.map +1 -0
- package/dist/string/str.mjs +42 -0
- package/dist/string/str.mjs.map +1 -0
- package/package.json +31 -92
- package/src/array/impl/array-utils-creation.mts +2 -1
- package/src/array/impl/array-utils-element-access.mts +3 -3
- package/src/array/impl/array-utils-element-access.test.mts +3 -3
- package/src/{guard/as-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-cast.mts} +9 -9
- package/src/{guard/as-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-cast.test.mts} +2 -2
- package/src/{guard/is-length-bounded-array.mts → array/impl/array-utils-length-bounded-array-guard.mts} +12 -12
- package/src/{guard/is-length-bounded-array.test.mts → array/impl/array-utils-length-bounded-array-guard.test.mts} +2 -2
- package/src/array/impl/array-utils-modification.mts +9 -8
- package/src/array/impl/array-utils-modification.test.mts +6 -1
- package/src/array/impl/array-utils-reducing-value.mts +9 -9
- package/src/array/impl/array-utils-size.mts +2 -2
- package/src/array/impl/array-utils-slicing.mts +24 -13
- package/src/array/impl/array-utils-transformation.mts +18 -12
- package/src/array/impl/array-utils-transformation.test.mts +12 -12
- package/src/array/impl/index.mts +2 -0
- package/src/guard/index.mts +0 -3
- package/src/index.mts +1 -0
- package/src/number/branded-types/finite-number.mts +47 -61
- package/src/number/branded-types/int.mts +40 -46
- package/src/number/branded-types/int16.mts +65 -58
- package/src/number/branded-types/int32.mts +65 -58
- package/src/number/branded-types/negative-finite-number.mts +68 -68
- package/src/number/branded-types/negative-int.mts +60 -57
- package/src/number/branded-types/negative-safe-int.mts +57 -65
- package/src/number/branded-types/non-negative-finite-number.mts +74 -64
- package/src/number/branded-types/non-negative-int16.mts +64 -57
- package/src/number/branded-types/non-negative-int32.mts +64 -58
- package/src/number/branded-types/non-positive-finite-number.mts +64 -54
- package/src/number/branded-types/non-positive-int.mts +41 -146
- package/src/number/branded-types/non-positive-safe-int.mts +54 -53
- package/src/number/branded-types/non-zero-finite-number.mts +62 -51
- package/src/number/branded-types/non-zero-int.mts +51 -38
- package/src/number/branded-types/non-zero-int16.mts +52 -53
- package/src/number/branded-types/non-zero-int32.mts +52 -54
- package/src/number/branded-types/non-zero-safe-int.mts +53 -54
- package/src/number/branded-types/non-zero-uint16.mts +52 -53
- package/src/number/branded-types/non-zero-uint32.mts +52 -53
- package/src/number/branded-types/positive-finite-number.mts +74 -63
- package/src/number/branded-types/positive-int.mts +46 -68
- package/src/number/branded-types/positive-int16.mts +61 -57
- package/src/number/branded-types/positive-int32.mts +61 -57
- package/src/number/branded-types/positive-safe-int.mts +62 -57
- package/src/number/branded-types/positive-uint16.mts +61 -57
- package/src/number/branded-types/positive-uint32.mts +61 -58
- package/src/number/branded-types/safe-int.mts +43 -62
- package/src/number/branded-types/safe-uint.mts +62 -57
- package/src/number/branded-types/uint.mts +63 -50
- package/src/number/branded-types/uint16.mts +60 -58
- package/src/number/branded-types/uint32.mts +59 -55
- package/src/number/enum/int8.mts +56 -65
- package/src/number/enum/uint8.mts +60 -58
- package/src/string/index.mts +1 -0
- package/src/string/str.mts +371 -0
- package/src/string/str.test.mts +215 -0
- package/dist/guard/as-length-bounded-array.d.mts.map +0 -1
- package/dist/guard/as-length-bounded-array.mjs.map +0 -1
- package/dist/guard/is-length-bounded-array.d.mts.map +0 -1
- package/dist/guard/is-length-bounded-array.mjs.map +0 -1
- package/dist/guard/is-length-bounded-string.d.mts +0 -163
- package/dist/guard/is-length-bounded-string.d.mts.map +0 -1
- package/dist/guard/is-length-bounded-string.mjs +0 -7
- package/dist/guard/is-length-bounded-string.mjs.map +0 -1
- package/src/guard/is-length-bounded-string.mts +0 -199
- package/src/guard/is-length-bounded-string.test.mts +0 -170
|
@@ -34,132 +34,138 @@ const {
|
|
|
34
34
|
} as const);
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
* in the range [0, 2^31)).
|
|
37
|
+
* Type guard that checks if a value is a non-negative integer in [0, 2^31).
|
|
39
38
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Returns `true` for a non-negative integer in [0, 2^31) — a value with no
|
|
40
|
+
* fractional component.
|
|
41
|
+
*
|
|
42
|
+
* @param value - The value to check
|
|
43
|
+
* @returns `true` if the value is a non-negative integer in [0, 2^31), `false` otherwise
|
|
42
44
|
*/
|
|
43
45
|
export const isNonNegativeInt32 = is;
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
|
-
* Casts a number to
|
|
48
|
+
* Casts a `number` to the `NonNegativeInt32` branded type.
|
|
49
|
+
*
|
|
50
|
+
* Validates that the value is a non-negative integer in [0, 2^31) and returns
|
|
51
|
+
* it with the `NonNegativeInt32` brand. Throws a `TypeError` otherwise.
|
|
47
52
|
*
|
|
48
|
-
* @param value The value to cast
|
|
49
|
-
* @returns The value as a NonNegativeInt32
|
|
50
|
-
* @throws {TypeError} If the value is not a non-negative integer in [0, 2^31)
|
|
53
|
+
* @param value - The value to cast
|
|
54
|
+
* @returns The value as a `NonNegativeInt32`
|
|
55
|
+
* @throws {TypeError} If the value is not a non-negative integer in [0, 2^31)
|
|
51
56
|
*/
|
|
52
57
|
export const asNonNegativeInt32 = castType;
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
|
-
* Namespace providing type-safe
|
|
56
|
-
*
|
|
60
|
+
* Namespace providing type-safe operations for the `NonNegativeInt32` branded
|
|
61
|
+
* type.
|
|
57
62
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* non-negative integer constraint, with negative results clamped to 0 and
|
|
61
|
-
* overflow results clamped to MAX_VALUE.
|
|
63
|
+
* The `NonNegativeInt32` type represents a non-negative integer in [0, 2^31).
|
|
64
|
+
* Division (`div`) uses floor division.
|
|
62
65
|
*/
|
|
63
66
|
export const NonNegativeInt32 = {
|
|
64
67
|
/**
|
|
65
|
-
* Type guard
|
|
68
|
+
* Type guard that checks if a value is a non-negative integer in [0, 2^31).
|
|
66
69
|
*
|
|
67
|
-
* @param value The value to check
|
|
68
|
-
* @returns `true` if the value is a
|
|
69
|
-
*
|
|
70
|
+
* @param value - The value to check
|
|
71
|
+
* @returns `true` if the value is a non-negative integer in [0, 2^31), `false` otherwise
|
|
72
|
+
* @see {@link isNonNegativeInt32} for usage examples
|
|
70
73
|
*/
|
|
71
74
|
is,
|
|
72
75
|
|
|
73
76
|
/**
|
|
74
|
-
* The
|
|
75
|
-
*
|
|
76
|
-
* @readonly
|
|
77
|
+
* The smallest value representable as `NonNegativeInt32`.
|
|
77
78
|
*/
|
|
78
79
|
MIN_VALUE,
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
|
-
* The
|
|
82
|
-
*
|
|
83
|
-
* @readonly
|
|
82
|
+
* The largest value representable as `NonNegativeInt32`.
|
|
84
83
|
*/
|
|
85
84
|
MAX_VALUE,
|
|
86
85
|
|
|
87
86
|
/**
|
|
88
|
-
* Returns the
|
|
87
|
+
* Returns the smallest of the given non-negative integers.
|
|
89
88
|
*
|
|
90
|
-
* @param
|
|
91
|
-
* @
|
|
92
|
-
* @returns The minimum value as a NonNegativeInt32.
|
|
89
|
+
* @param values - The non-negative integers to compare (at least one required)
|
|
90
|
+
* @returns The smallest value as a `NonNegativeInt32`
|
|
93
91
|
*/
|
|
94
92
|
min: min_,
|
|
95
93
|
|
|
96
94
|
/**
|
|
97
|
-
* Returns the
|
|
95
|
+
* Returns the largest of the given non-negative integers.
|
|
98
96
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @
|
|
101
|
-
* @returns The maximum value as a NonNegativeInt32.
|
|
97
|
+
* @param values - The non-negative integers to compare (at least one required)
|
|
98
|
+
* @returns The largest value as a `NonNegativeInt32`
|
|
102
99
|
*/
|
|
103
100
|
max: max_,
|
|
104
101
|
|
|
105
102
|
/**
|
|
106
|
-
* Clamps a number
|
|
103
|
+
* Clamps a `number` into the `NonNegativeInt32` range, rounding to the
|
|
104
|
+
* nearest integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
|
|
107
105
|
*
|
|
108
|
-
* @param value The
|
|
109
|
-
* @returns The
|
|
106
|
+
* @param value - The value to clamp
|
|
107
|
+
* @returns The clamped value as a `NonNegativeInt32`
|
|
110
108
|
*/
|
|
111
109
|
clamp,
|
|
112
110
|
|
|
113
111
|
/**
|
|
114
|
-
* Generates a random NonNegativeInt32
|
|
112
|
+
* Generates a random `NonNegativeInt32` within the given range.
|
|
113
|
+
*
|
|
114
|
+
* The range is inclusive on both ends.
|
|
115
115
|
*
|
|
116
|
-
* @
|
|
116
|
+
* @param min - The minimum value (inclusive)
|
|
117
|
+
* @param max - The maximum value (inclusive)
|
|
118
|
+
* @returns A random `NonNegativeInt32` in `[min, max]`
|
|
117
119
|
*/
|
|
118
120
|
random,
|
|
119
121
|
|
|
120
122
|
/**
|
|
121
|
-
* Raises a
|
|
123
|
+
* Raises `a` to the power `b`, returning `a ** b` as a `NonNegativeInt32`
|
|
124
|
+
* (floored to an integer).
|
|
122
125
|
*
|
|
123
|
-
* @param a The base
|
|
124
|
-
* @param b The exponent
|
|
125
|
-
* @returns `a ** b`
|
|
126
|
+
* @param a - The base non-negative integer
|
|
127
|
+
* @param b - The exponent non-negative integer
|
|
128
|
+
* @returns `a ** b` as a `NonNegativeInt32`
|
|
126
129
|
*/
|
|
127
130
|
pow,
|
|
128
131
|
|
|
129
132
|
/**
|
|
130
|
-
* Adds two NonNegativeInt32
|
|
133
|
+
* Adds two non-negative integers, returning `a + b` as a `NonNegativeInt32`.
|
|
131
134
|
*
|
|
132
|
-
* @param a The first
|
|
133
|
-
* @param b The second
|
|
134
|
-
* @returns `a
|
|
135
|
+
* @param a - The first non-negative integer
|
|
136
|
+
* @param b - The second non-negative integer
|
|
137
|
+
* @returns The sum of `a` and `b` as a `NonNegativeInt32`
|
|
135
138
|
*/
|
|
136
139
|
add,
|
|
137
140
|
|
|
138
141
|
/**
|
|
139
|
-
* Subtracts
|
|
142
|
+
* Subtracts two non-negative integers, returning `a - b` as a
|
|
143
|
+
* `NonNegativeInt32`.
|
|
140
144
|
*
|
|
141
|
-
* @param a The
|
|
142
|
-
* @param b The
|
|
143
|
-
* @returns `a
|
|
144
|
-
* 0).
|
|
145
|
+
* @param a - The first non-negative integer
|
|
146
|
+
* @param b - The second non-negative integer
|
|
147
|
+
* @returns The difference of `a` and `b` as a `NonNegativeInt32`
|
|
145
148
|
*/
|
|
146
149
|
sub,
|
|
147
150
|
|
|
148
151
|
/**
|
|
149
|
-
* Multiplies two
|
|
152
|
+
* Multiplies two non-negative integers, returning `a * b` as a
|
|
153
|
+
* `NonNegativeInt32`.
|
|
150
154
|
*
|
|
151
|
-
* @param a The first
|
|
152
|
-
* @param b The second
|
|
153
|
-
* @returns `a
|
|
155
|
+
* @param a - The first non-negative integer
|
|
156
|
+
* @param b - The second non-negative integer
|
|
157
|
+
* @returns The product of `a` and `b` as a `NonNegativeInt32`
|
|
154
158
|
*/
|
|
155
159
|
mul,
|
|
156
160
|
|
|
157
161
|
/**
|
|
158
|
-
* Divides
|
|
162
|
+
* Divides two non-negative integers using floor division (`⌊a / b⌋`): the
|
|
163
|
+
* result is `a / b` rounded toward negative infinity, as a
|
|
164
|
+
* `NonNegativeInt32`.
|
|
159
165
|
*
|
|
160
|
-
* @param a The dividend
|
|
161
|
-
* @param b The divisor
|
|
162
|
-
* @returns
|
|
166
|
+
* @param a - The dividend
|
|
167
|
+
* @param b - The divisor (must be non-zero)
|
|
168
|
+
* @returns The floored quotient as a `NonNegativeInt32`
|
|
163
169
|
*/
|
|
164
170
|
div,
|
|
165
171
|
} as const;
|
|
@@ -63,129 +63,139 @@ const round = (
|
|
|
63
63
|
>;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Type guard that checks if a value is a non-positive finite number.
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Returns `true` only for a finite value — never `NaN`, `Infinity`, or
|
|
69
|
+
* `-Infinity`.
|
|
70
|
+
*
|
|
71
|
+
* @param value - The value to check
|
|
72
|
+
* @returns `true` if the value is a non-positive finite number, `false` otherwise
|
|
70
73
|
*/
|
|
71
74
|
export const isNonPositiveFiniteNumber = is;
|
|
72
75
|
|
|
73
76
|
/**
|
|
74
|
-
* Casts a number to
|
|
77
|
+
* Casts a `number` to the `NonPositiveFiniteNumber` branded type.
|
|
78
|
+
*
|
|
79
|
+
* Validates that the value is a non-positive finite number and returns it with
|
|
80
|
+
* the `NonPositiveFiniteNumber` brand. Throws a `TypeError` otherwise.
|
|
75
81
|
*
|
|
76
|
-
* @param value The value to cast
|
|
77
|
-
* @returns The value as a NonPositiveFiniteNumber
|
|
78
|
-
* @throws {TypeError} If the value is not a non-positive finite number
|
|
82
|
+
* @param value - The value to cast
|
|
83
|
+
* @returns The value as a `NonPositiveFiniteNumber`
|
|
84
|
+
* @throws {TypeError} If the value is not a non-positive finite number
|
|
79
85
|
*/
|
|
80
86
|
export const asNonPositiveFiniteNumber = castType;
|
|
81
87
|
|
|
82
88
|
/**
|
|
83
|
-
* Namespace providing type-safe
|
|
84
|
-
*
|
|
89
|
+
* Namespace providing type-safe operations for the `NonPositiveFiniteNumber`
|
|
90
|
+
* branded type.
|
|
85
91
|
*
|
|
86
|
-
*
|
|
87
|
-
* results to MAX_VALUE (0), while ensuring results remain finite (excluding NaN
|
|
88
|
-
* and Infinity). This type is useful for representing quantities that must
|
|
89
|
-
* always be non-positive, such as debts, penalties, and negative offsets.
|
|
92
|
+
* The `NonPositiveFiniteNumber` type represents a non-positive finite number.
|
|
90
93
|
*/
|
|
91
94
|
export const NonPositiveFiniteNumber = {
|
|
92
95
|
/**
|
|
93
|
-
* Type guard
|
|
96
|
+
* Type guard that checks if a value is a non-positive finite number.
|
|
94
97
|
*
|
|
95
|
-
* @param value The value to check
|
|
96
|
-
* @returns `true` if the value is a non-positive finite number, `false`
|
|
97
|
-
*
|
|
98
|
+
* @param value - The value to check
|
|
99
|
+
* @returns `true` if the value is a non-positive finite number, `false` otherwise
|
|
100
|
+
* @see {@link isNonPositiveFiniteNumber} for usage examples
|
|
98
101
|
*/
|
|
99
102
|
is,
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
|
-
* The
|
|
103
|
-
*
|
|
104
|
-
* @readonly
|
|
105
|
+
* The largest value representable as `NonPositiveFiniteNumber`.
|
|
105
106
|
*/
|
|
106
107
|
MAX_VALUE,
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
|
-
* Returns the
|
|
110
|
+
* Returns the smallest of the given non-positive finite numbers.
|
|
110
111
|
*
|
|
111
|
-
* @param
|
|
112
|
-
* @
|
|
113
|
-
* @returns The minimum value as a NonPositiveFiniteNumber.
|
|
112
|
+
* @param values - The non-positive finite numbers to compare (at least one required)
|
|
113
|
+
* @returns The smallest value as a `NonPositiveFiniteNumber`
|
|
114
114
|
*/
|
|
115
115
|
min: min_,
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Returns the
|
|
118
|
+
* Returns the largest of the given non-positive finite numbers.
|
|
119
119
|
*
|
|
120
|
-
* @param
|
|
121
|
-
* @
|
|
122
|
-
* @returns The maximum value as a NonPositiveFiniteNumber.
|
|
120
|
+
* @param values - The non-positive finite numbers to compare (at least one required)
|
|
121
|
+
* @returns The largest value as a `NonPositiveFiniteNumber`
|
|
123
122
|
*/
|
|
124
123
|
max: max_,
|
|
125
124
|
|
|
126
125
|
/**
|
|
127
|
-
* Clamps a number
|
|
126
|
+
* Clamps a `number` into the `NonPositiveFiniteNumber` range `[MIN_VALUE,
|
|
127
|
+
* MAX_VALUE]`.
|
|
128
128
|
*
|
|
129
|
-
* @param value The
|
|
130
|
-
* @returns The
|
|
129
|
+
* @param value - The value to clamp
|
|
130
|
+
* @returns The clamped value as a `NonPositiveFiniteNumber`
|
|
131
131
|
*/
|
|
132
132
|
clamp,
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* Returns the greatest integer less than or equal to a non-positive finite
|
|
136
|
+
* number.
|
|
136
137
|
*
|
|
137
|
-
* @param
|
|
138
|
-
* @returns The
|
|
138
|
+
* @param a - The non-positive finite number value
|
|
139
|
+
* @returns The floored value as an integer
|
|
139
140
|
*/
|
|
140
141
|
floor,
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
|
-
*
|
|
144
|
+
* Returns the smallest integer greater than or equal to a non-positive finite
|
|
145
|
+
* number.
|
|
144
146
|
*
|
|
145
|
-
* @param
|
|
146
|
-
* @returns The
|
|
147
|
+
* @param a - The non-positive finite number value
|
|
148
|
+
* @returns The ceiled value as an integer
|
|
147
149
|
*/
|
|
148
150
|
ceil,
|
|
149
151
|
|
|
150
152
|
/**
|
|
151
|
-
*
|
|
153
|
+
* Returns the value of a non-positive finite number rounded to the nearest
|
|
154
|
+
* integer.
|
|
152
155
|
*
|
|
153
|
-
* @param
|
|
154
|
-
* @returns The rounded value as
|
|
156
|
+
* @param a - The non-positive finite number value
|
|
157
|
+
* @returns The rounded value as an integer
|
|
155
158
|
*/
|
|
156
159
|
round,
|
|
157
160
|
|
|
158
161
|
/**
|
|
159
|
-
* Generates a random NonPositiveFiniteNumber
|
|
162
|
+
* Generates a random `NonPositiveFiniteNumber` within the given range.
|
|
163
|
+
*
|
|
164
|
+
* The range is inclusive on both ends.
|
|
160
165
|
*
|
|
161
|
-
* @
|
|
166
|
+
* @param min - The minimum value (inclusive)
|
|
167
|
+
* @param max - The maximum value (inclusive)
|
|
168
|
+
* @returns A random `NonPositiveFiniteNumber` in `[min, max]`
|
|
162
169
|
*/
|
|
163
170
|
random,
|
|
164
171
|
|
|
165
172
|
/**
|
|
166
|
-
* Raises a
|
|
173
|
+
* Raises `a` to the power `b`, returning `a ** b` as a
|
|
174
|
+
* `NonPositiveFiniteNumber`.
|
|
167
175
|
*
|
|
168
|
-
* @param a The base
|
|
169
|
-
* @param b The exponent
|
|
170
|
-
* @returns `a ** b`
|
|
176
|
+
* @param a - The base non-positive finite number
|
|
177
|
+
* @param b - The exponent non-positive finite number
|
|
178
|
+
* @returns `a ** b` as a `NonPositiveFiniteNumber`
|
|
171
179
|
*/
|
|
172
180
|
pow,
|
|
173
181
|
|
|
174
182
|
/**
|
|
175
|
-
* Adds two
|
|
183
|
+
* Adds two non-positive finite numbers, returning `a + b` as a
|
|
184
|
+
* `NonPositiveFiniteNumber`.
|
|
176
185
|
*
|
|
177
|
-
* @param a The first
|
|
178
|
-
* @param b The second
|
|
179
|
-
* @returns `a
|
|
186
|
+
* @param a - The first non-positive finite number
|
|
187
|
+
* @param b - The second non-positive finite number
|
|
188
|
+
* @returns The sum of `a` and `b` as a `NonPositiveFiniteNumber`
|
|
180
189
|
*/
|
|
181
190
|
add,
|
|
182
191
|
|
|
183
192
|
/**
|
|
184
|
-
* Subtracts
|
|
193
|
+
* Subtracts two non-positive finite numbers, returning `a - b` as a
|
|
194
|
+
* `NonPositiveFiniteNumber`.
|
|
185
195
|
*
|
|
186
|
-
* @param a The
|
|
187
|
-
* @param b The
|
|
188
|
-
* @returns `a
|
|
196
|
+
* @param a - The first non-positive finite number
|
|
197
|
+
* @param b - The second non-positive finite number
|
|
198
|
+
* @returns The difference of `a` and `b` as a `NonPositiveFiniteNumber`
|
|
189
199
|
*/
|
|
190
200
|
sub,
|
|
191
201
|
} as const;
|
|
@@ -32,19 +32,9 @@ const {
|
|
|
32
32
|
/**
|
|
33
33
|
* Type guard that checks if a value is a non-positive integer.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
*
|
|
41
|
-
* ```ts
|
|
42
|
-
* assert.isTrue(isNonPositiveInt(0));
|
|
43
|
-
*
|
|
44
|
-
* assert.isTrue(isNonPositiveInt(-5));
|
|
45
|
-
*
|
|
46
|
-
* assert.isFalse(isNonPositiveInt(1));
|
|
47
|
-
* ```
|
|
35
|
+
* Returns `true` for a non-positive integer — a value with no fractional
|
|
36
|
+
* component, including values outside the safe integer range (unlike
|
|
37
|
+
* `SafeInt`).
|
|
48
38
|
*
|
|
49
39
|
* @param value - The value to check
|
|
50
40
|
* @returns `true` if the value is a non-positive integer, `false` otherwise
|
|
@@ -52,200 +42,105 @@ const {
|
|
|
52
42
|
export const isNonPositiveInt = is;
|
|
53
43
|
|
|
54
44
|
/**
|
|
55
|
-
* Casts a number to
|
|
56
|
-
*
|
|
57
|
-
* This function validates that the input is a non-positive integer (<= 0) and
|
|
58
|
-
* returns it with the NonPositiveInt brand. This ensures type safety for
|
|
59
|
-
* operations that require non-positive integer values.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
45
|
+
* Casts a `number` to the `NonPositiveInt` branded type.
|
|
62
46
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* assert.isTrue(branded === -7);
|
|
67
|
-
*
|
|
68
|
-
* assert.isTrue(NonPositiveInt.is(branded));
|
|
69
|
-
* ```
|
|
47
|
+
* Validates that the value is a non-positive integer and returns it with the
|
|
48
|
+
* `NonPositiveInt` brand. Throws a `TypeError` otherwise.
|
|
70
49
|
*
|
|
71
50
|
* @param value - The value to cast
|
|
72
|
-
* @returns The value as a NonPositiveInt
|
|
51
|
+
* @returns The value as a `NonPositiveInt`
|
|
73
52
|
* @throws {TypeError} If the value is not a non-positive integer
|
|
74
53
|
*/
|
|
75
54
|
export const asNonPositiveInt = castType;
|
|
76
55
|
|
|
77
56
|
/**
|
|
78
|
-
* Namespace providing type-safe operations for NonPositiveInt branded
|
|
79
|
-
*
|
|
80
|
-
* NonPositiveInt represents integers that are less than or equal to zero (<= 0).
|
|
81
|
-
* All operations automatically clamp results to maintain the non-positive
|
|
82
|
-
* constraint, ensuring that arithmetic operations never produce positive values.
|
|
57
|
+
* Namespace providing type-safe operations for the `NonPositiveInt` branded
|
|
58
|
+
* type.
|
|
83
59
|
*
|
|
84
|
-
*
|
|
60
|
+
* The `NonPositiveInt` type represents a non-positive integer. Division (`div`)
|
|
61
|
+
* uses floor division.
|
|
85
62
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* - Negative counts or differences
|
|
90
|
-
* - Depth or altitude below a reference point
|
|
63
|
+
* Unlike `SafeInt`, `NonPositiveInt` allows values outside the safe integer
|
|
64
|
+
* range (±2^53 − 1), so very large magnitudes may lose precision in
|
|
65
|
+
* JavaScript's `number` type.
|
|
91
66
|
*/
|
|
92
67
|
export const NonPositiveInt = {
|
|
93
68
|
/**
|
|
94
69
|
* Type guard that checks if a value is a non-positive integer.
|
|
95
70
|
*
|
|
96
|
-
* @example
|
|
97
|
-
*
|
|
98
|
-
* ```ts
|
|
99
|
-
* const value: number = -42;
|
|
100
|
-
*
|
|
101
|
-
* if (NonPositiveInt.is(value)) {
|
|
102
|
-
* // value is now typed as NonPositiveInt
|
|
103
|
-
* const debt = value;
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
71
|
* @param value - The value to check
|
|
108
72
|
* @returns `true` if the value is a non-positive integer, `false` otherwise
|
|
73
|
+
* @see {@link isNonPositiveInt} for usage examples
|
|
109
74
|
*/
|
|
110
75
|
is,
|
|
111
76
|
|
|
112
77
|
/**
|
|
113
|
-
* The
|
|
114
|
-
*
|
|
115
|
-
* @readonly
|
|
78
|
+
* The largest value representable as `NonPositiveInt`.
|
|
116
79
|
*/
|
|
117
80
|
MAX_VALUE,
|
|
118
81
|
|
|
119
82
|
/**
|
|
120
|
-
* Returns the
|
|
121
|
-
*
|
|
122
|
-
* Since non-positive integers range from negative infinity to 0, the smaller
|
|
123
|
-
* value is the one further from zero (more negative).
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
83
|
+
* Returns the smallest of the given non-positive integers.
|
|
126
84
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* assert.strictEqual(result, -10);
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @param a - The first non-positive integer
|
|
134
|
-
* @param b - The second non-positive integer
|
|
135
|
-
* @returns The minimum value as a non-positive integer
|
|
85
|
+
* @param values - The non-positive integers to compare (at least one required)
|
|
86
|
+
* @returns The smallest value as a `NonPositiveInt`
|
|
136
87
|
*/
|
|
137
88
|
min: min_,
|
|
138
89
|
|
|
139
90
|
/**
|
|
140
|
-
* Returns the
|
|
141
|
-
*
|
|
142
|
-
* Since non-positive integers range from negative infinity to 0, the larger
|
|
143
|
-
* value is the one closer to zero (less negative).
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
*
|
|
147
|
-
* ```ts
|
|
148
|
-
* const result = NonPositiveInt.max(-5, -10);
|
|
149
|
-
*
|
|
150
|
-
* assert.strictEqual(result, -5);
|
|
151
|
-
* ```
|
|
91
|
+
* Returns the largest of the given non-positive integers.
|
|
152
92
|
*
|
|
153
|
-
* @param
|
|
154
|
-
* @
|
|
155
|
-
* @returns The maximum value as a non-positive integer
|
|
93
|
+
* @param values - The non-positive integers to compare (at least one required)
|
|
94
|
+
* @returns The largest value as a `NonPositiveInt`
|
|
156
95
|
*/
|
|
157
96
|
max: max_,
|
|
158
97
|
|
|
159
98
|
/**
|
|
160
|
-
* Clamps a number
|
|
161
|
-
*
|
|
162
|
-
* Any positive value is clamped to 0 (the maximum non-positive integer).
|
|
163
|
-
* Negative values are preserved as long as they are valid integers.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
*
|
|
167
|
-
* ```ts
|
|
168
|
-
* assert.strictEqual(NonPositiveInt.clamp(5), 0);
|
|
169
|
-
*
|
|
170
|
-
* assert.strictEqual(NonPositiveInt.clamp(-5), -5);
|
|
99
|
+
* Clamps a `number` into the `NonPositiveInt` range, rounding to the nearest
|
|
100
|
+
* integer and constraining the result to `[MIN_VALUE, MAX_VALUE]`.
|
|
171
101
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @param value - The number to clamp
|
|
176
|
-
* @returns The value clamped to the non-positive integer range
|
|
102
|
+
* @param value - The value to clamp
|
|
103
|
+
* @returns The clamped value as a `NonPositiveInt`
|
|
177
104
|
*/
|
|
178
105
|
clamp,
|
|
179
106
|
|
|
180
107
|
/**
|
|
181
|
-
* Generates a random
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
*
|
|
185
|
-
* ```ts
|
|
186
|
-
* const randomValue = NonPositiveInt.random();
|
|
108
|
+
* Generates a random `NonPositiveInt` within the given range.
|
|
187
109
|
*
|
|
188
|
-
*
|
|
189
|
-
* ```
|
|
110
|
+
* The range is inclusive on both ends.
|
|
190
111
|
*
|
|
191
|
-
* @
|
|
112
|
+
* @param min - The minimum value (inclusive)
|
|
113
|
+
* @param max - The maximum value (inclusive)
|
|
114
|
+
* @returns A random `NonPositiveInt` in `[min, max]`
|
|
192
115
|
*/
|
|
193
116
|
random,
|
|
194
117
|
|
|
195
118
|
/**
|
|
196
|
-
* Raises a
|
|
197
|
-
*
|
|
198
|
-
* The result is clamped to the non-positive integer range.
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
*
|
|
202
|
-
* ```ts
|
|
203
|
-
* const result = NonPositiveInt.pow(-2, -1);
|
|
204
|
-
* ```
|
|
119
|
+
* Raises `a` to the power `b`, returning `a ** b` as a `NonPositiveInt`
|
|
120
|
+
* (floored to an integer).
|
|
205
121
|
*
|
|
206
122
|
* @param a - The base non-positive integer
|
|
207
123
|
* @param b - The exponent non-positive integer
|
|
208
|
-
* @returns `a ** b`
|
|
124
|
+
* @returns `a ** b` as a `NonPositiveInt`
|
|
209
125
|
*/
|
|
210
126
|
pow,
|
|
211
127
|
|
|
212
128
|
/**
|
|
213
|
-
* Adds two non-positive integers
|
|
214
|
-
*
|
|
215
|
-
* The result is clamped to the non-positive integer range. If the sum is
|
|
216
|
-
* positive, it is clamped to 0.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
*
|
|
220
|
-
* ```ts
|
|
221
|
-
* assert.strictEqual(NonPositiveInt.add(-5, -3), -8);
|
|
222
|
-
*
|
|
223
|
-
* assert.strictEqual(NonPositiveInt.add(-5, 10), 0);
|
|
224
|
-
* ```
|
|
129
|
+
* Adds two non-positive integers, returning `a + b` as a `NonPositiveInt`.
|
|
225
130
|
*
|
|
226
131
|
* @param a - The first non-positive integer
|
|
227
132
|
* @param b - The second non-positive integer
|
|
228
|
-
* @returns `a
|
|
133
|
+
* @returns The sum of `a` and `b` as a `NonPositiveInt`
|
|
229
134
|
*/
|
|
230
135
|
add,
|
|
231
136
|
|
|
232
137
|
/**
|
|
233
|
-
* Subtracts
|
|
234
|
-
*
|
|
235
|
-
* The result is clamped to the non-positive integer range. If the result is
|
|
236
|
-
* positive, it is clamped to 0.
|
|
138
|
+
* Subtracts two non-positive integers, returning `a - b` as a
|
|
139
|
+
* `NonPositiveInt`.
|
|
237
140
|
*
|
|
238
|
-
* @
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* assert.strictEqual(NonPositiveInt.sub(-10, -3), -7);
|
|
242
|
-
*
|
|
243
|
-
* assert.strictEqual(NonPositiveInt.sub(-10, 5), 0);
|
|
244
|
-
* ```
|
|
245
|
-
*
|
|
246
|
-
* @param a - The minuend non-positive integer
|
|
247
|
-
* @param b - The subtrahend non-positive integer
|
|
248
|
-
* @returns `a - b` clamped to the non-positive integer range
|
|
141
|
+
* @param a - The first non-positive integer
|
|
142
|
+
* @param b - The second non-positive integer
|
|
143
|
+
* @returns The difference of `a` and `b` as a `NonPositiveInt`
|
|
249
144
|
*/
|
|
250
145
|
sub,
|
|
251
146
|
} as const;
|