ts-data-forge 12.2.1 → 12.2.2
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 +3 -6
- package/dist/array/impl/array-utils-creation.d.mts +1 -1
- package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts +1 -1
- package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
- package/dist/array/impl/array-utils-element-access.mjs +10 -13
- package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
- package/dist/array/impl/array-utils-iterators.d.mts +1 -1
- package/dist/array/impl/array-utils-iterators.d.mts.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-array-cast.d.mts.map +1 -1
- package/dist/array/impl/array-utils-length-bounded-array-cast.mjs +53 -53
- package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs +61 -70
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +37 -47
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts.map +1 -1
- package/dist/array/impl/array-utils-search.mjs +80 -92
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-set-op.d.mts +1 -1
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +1 -1
- package/dist/array/impl/array-utils-size.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs +9 -10
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +20 -32
- 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 +41 -52
- 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 +10 -16
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/json/json.mjs +1 -1
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.d.mts +6 -3
- package/dist/number/branded-types/finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/negative-finite-number.d.mts +8 -4
- package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/negative-int.d.mts +2 -1
- package/dist/number/branded-types/negative-int.d.mts.map +1 -1
- package/dist/number/branded-types/negative-safe-int.d.mts +2 -1
- package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-negative-finite-number.d.mts +6 -3
- package/dist/number/branded-types/non-negative-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-positive-finite-number.d.mts +6 -3
- package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.d.mts +6 -3
- package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/positive-finite-number.d.mts +6 -3
- package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
- package/dist/number/enum/int8.d.mts +26 -13
- package/dist/number/enum/int8.d.mts.map +1 -1
- package/dist/number/enum/uint8.d.mts +24 -12
- package/dist/number/enum/uint8.d.mts.map +1 -1
- package/dist/others/if-then.d.mts +1 -1
- package/dist/others/if-then.d.mts.map +1 -1
- package/dist/string/str.d.mts.map +1 -1
- package/dist/string/str.mjs +52 -52
- package/dist/string/str.mjs.map +1 -1
- package/package.json +4 -4
- package/src/array/impl/array-utils-element-access.mts +15 -16
- package/src/array/impl/array-utils-length-bounded-array-cast.mts +73 -60
- package/src/array/impl/array-utils-modification.mts +96 -94
- package/src/array/impl/array-utils-reducing-value.mts +68 -57
- package/src/array/impl/array-utils-search.mts +146 -148
- package/src/array/impl/array-utils-slice-clamped.mts +16 -14
- package/src/array/impl/array-utils-slicing.mts +37 -40
- package/src/array/impl/array-utils-transformation.mts +64 -62
- package/src/array/impl/array-utils-transformation.test.mts +1 -1
- package/src/array/impl/array-utils-validation.mts +18 -20
- package/src/collections/iset.test.mts +2 -2
- package/src/functional/pipe.test.mts +1 -1
- package/src/json/json.mts +1 -1
- package/src/string/str.mts +74 -61
|
@@ -2,6 +2,9 @@ import { type NonZeroFiniteNumber as TtfImported_NonZeroFiniteNumber } from 'ts-
|
|
|
2
2
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
3
|
export type NonZeroFiniteNumber = TtfImported_NonZeroFiniteNumber;
|
|
4
4
|
type ElementType = NonZeroFiniteNumber;
|
|
5
|
+
declare const floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
6
|
+
declare const ceil: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
7
|
+
declare const round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
5
8
|
/**
|
|
6
9
|
* Type guard that checks if a value is a non-zero finite number.
|
|
7
10
|
*
|
|
@@ -74,7 +77,7 @@ export declare const NonZeroFiniteNumber: {
|
|
|
74
77
|
* @param a - The non-zero finite number value
|
|
75
78
|
* @returns The floored value as an integer
|
|
76
79
|
*/
|
|
77
|
-
readonly floor:
|
|
80
|
+
readonly floor: typeof floor;
|
|
78
81
|
/**
|
|
79
82
|
* Returns the smallest integer greater than or equal to a non-zero finite
|
|
80
83
|
* number.
|
|
@@ -82,7 +85,7 @@ export declare const NonZeroFiniteNumber: {
|
|
|
82
85
|
* @param a - The non-zero finite number value
|
|
83
86
|
* @returns The ceiled value as an integer
|
|
84
87
|
*/
|
|
85
|
-
readonly ceil:
|
|
88
|
+
readonly ceil: typeof ceil;
|
|
86
89
|
/**
|
|
87
90
|
* Returns the value of a non-zero finite number rounded to the nearest
|
|
88
91
|
* integer.
|
|
@@ -90,7 +93,7 @@ export declare const NonZeroFiniteNumber: {
|
|
|
90
93
|
* @param a - The non-zero finite number value
|
|
91
94
|
* @returns The rounded value as an integer
|
|
92
95
|
*/
|
|
93
|
-
readonly round:
|
|
96
|
+
readonly round: typeof round;
|
|
94
97
|
/**
|
|
95
98
|
* Generates a random `NonZeroFiniteNumber` within the given range.
|
|
96
99
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,IAAI,+BAA+B,EAC5D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"non-zero-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/non-zero-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,IAAI,+BAA+B,EAC5D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAElE,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAyBvC,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;AAc9E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,qDAAK,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;;;;;MAAW,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;CAEK,CAAC"}
|
|
@@ -2,6 +2,9 @@ import { type PositiveFiniteNumber as TtfImported_PositiveFiniteNumber } from 't
|
|
|
2
2
|
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
3
|
export type PositiveFiniteNumber = TtfImported_PositiveFiniteNumber;
|
|
4
4
|
type ElementType = PositiveFiniteNumber;
|
|
5
|
+
declare const floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>>;
|
|
6
|
+
declare const ceil: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
7
|
+
declare const round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>>;
|
|
5
8
|
/**
|
|
6
9
|
* Type guard that checks if a value is a positive finite number.
|
|
7
10
|
*
|
|
@@ -90,7 +93,7 @@ export declare const PositiveFiniteNumber: {
|
|
|
90
93
|
* @param a - The positive finite number value
|
|
91
94
|
* @returns The floored value as an integer
|
|
92
95
|
*/
|
|
93
|
-
readonly floor:
|
|
96
|
+
readonly floor: typeof floor;
|
|
94
97
|
/**
|
|
95
98
|
* Returns the smallest integer greater than or equal to a positive finite
|
|
96
99
|
* number.
|
|
@@ -98,7 +101,7 @@ export declare const PositiveFiniteNumber: {
|
|
|
98
101
|
* @param a - The positive finite number value
|
|
99
102
|
* @returns The ceiled value as an integer
|
|
100
103
|
*/
|
|
101
|
-
readonly ceil:
|
|
104
|
+
readonly ceil: typeof ceil;
|
|
102
105
|
/**
|
|
103
106
|
* Returns the value of a positive finite number rounded to the nearest
|
|
104
107
|
* integer.
|
|
@@ -106,7 +109,7 @@ export declare const PositiveFiniteNumber: {
|
|
|
106
109
|
* @param a - The positive finite number value
|
|
107
110
|
* @returns The rounded value as an integer
|
|
108
111
|
*/
|
|
109
|
-
readonly round:
|
|
112
|
+
readonly round: typeof round;
|
|
110
113
|
/**
|
|
111
114
|
* Generates a random `PositiveFiniteNumber` within the given range.
|
|
112
115
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,IAAI,gCAAgC,EAE9D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"positive-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/positive-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,IAAI,gCAAgC,EAE9D,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AA2BxC,QAAA,MAAM,KAAK,MACN,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAEJ,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,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAOzD,CAAC;AAcJ;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,sDAAK,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;MAAW,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;OAUG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;OAOG;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { type AbsoluteValue, type Int8 as TtfImported_Int8 } from 'ts-type-forge';
|
|
2
2
|
export type Int8 = TtfImported_Int8;
|
|
3
|
+
declare const is: (x: number) => x is Int8;
|
|
4
|
+
declare const castType: (x: number) => Int8;
|
|
5
|
+
declare const fromNumber: (a: number) => Int8;
|
|
6
|
+
declare const abs: <N extends Int8>(x: N) => AbsoluteValue<N>;
|
|
7
|
+
declare const min_: (...values: readonly Int8[]) => Int8;
|
|
8
|
+
declare const max_: (...values: readonly Int8[]) => Int8;
|
|
9
|
+
declare const pow: (x: Int8, y: Int8) => Int8;
|
|
10
|
+
declare const add: (x: Int8, y: Int8) => Int8;
|
|
11
|
+
declare const sub: (x: Int8, y: Int8) => Int8;
|
|
12
|
+
declare const mul: (x: Int8, y: Int8) => Int8;
|
|
13
|
+
declare const div: (x: Int8, y: Exclude<Int8, 0>) => Int8;
|
|
14
|
+
declare const random: (min: Int8, max: Int8) => Int8;
|
|
3
15
|
/**
|
|
4
16
|
* Type guard that checks if a value is an integer in [-128, 127].
|
|
5
17
|
*
|
|
@@ -9,7 +21,7 @@ export type Int8 = TtfImported_Int8;
|
|
|
9
21
|
* @param value - The value to check
|
|
10
22
|
* @returns `true` if the value is an integer in [-128, 127], `false` otherwise
|
|
11
23
|
*/
|
|
12
|
-
export declare const isInt8:
|
|
24
|
+
export declare const isInt8: typeof is;
|
|
13
25
|
/**
|
|
14
26
|
* Casts a `number` to the `Int8` branded type.
|
|
15
27
|
*
|
|
@@ -20,7 +32,7 @@ export declare const isInt8: (x: number) => x is Int8;
|
|
|
20
32
|
* @returns The value as an `Int8`
|
|
21
33
|
* @throws {TypeError} If the value is not an integer in [-128, 127]
|
|
22
34
|
*/
|
|
23
|
-
export declare const asInt8:
|
|
35
|
+
export declare const asInt8: typeof castType;
|
|
24
36
|
/**
|
|
25
37
|
* Namespace providing type-safe operations for the `Int8` branded type.
|
|
26
38
|
*
|
|
@@ -35,7 +47,7 @@ export declare const Int8: {
|
|
|
35
47
|
* @returns `true` if the value is an integer in [-128, 127], `false` otherwise
|
|
36
48
|
* @see {@link isInt8} for usage examples
|
|
37
49
|
*/
|
|
38
|
-
readonly is:
|
|
50
|
+
readonly is: typeof is;
|
|
39
51
|
/**
|
|
40
52
|
* The smallest value representable as `Int8` (the lower saturation target of
|
|
41
53
|
* `fromNumber`).
|
|
@@ -52,14 +64,14 @@ export declare const Int8: {
|
|
|
52
64
|
* @param values - The integers to compare (at least one required)
|
|
53
65
|
* @returns The smallest value as an `Int8`
|
|
54
66
|
*/
|
|
55
|
-
readonly min:
|
|
67
|
+
readonly min: typeof min_;
|
|
56
68
|
/**
|
|
57
69
|
* Returns the largest of the given integers.
|
|
58
70
|
*
|
|
59
71
|
* @param values - The integers to compare (at least one required)
|
|
60
72
|
* @returns The largest value as an `Int8`
|
|
61
73
|
*/
|
|
62
|
-
readonly max:
|
|
74
|
+
readonly max: typeof max_;
|
|
63
75
|
/**
|
|
64
76
|
* Converts an arbitrary `number` into an `Int8`, rounding to the nearest
|
|
65
77
|
* integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
|
|
@@ -70,7 +82,7 @@ export declare const Int8: {
|
|
|
70
82
|
* @param value - The value to convert
|
|
71
83
|
* @returns The value as an `Int8`
|
|
72
84
|
*/
|
|
73
|
-
readonly fromNumber:
|
|
85
|
+
readonly fromNumber: typeof fromNumber;
|
|
74
86
|
/**
|
|
75
87
|
* Returns the absolute value of an integer in [-128, 127].
|
|
76
88
|
*
|
|
@@ -79,7 +91,7 @@ export declare const Int8: {
|
|
|
79
91
|
* @param a - The integer value
|
|
80
92
|
* @returns The absolute value as a non-negative `Int8`
|
|
81
93
|
*/
|
|
82
|
-
readonly abs:
|
|
94
|
+
readonly abs: typeof abs;
|
|
83
95
|
/**
|
|
84
96
|
* Generates a random `Int8` within the given range.
|
|
85
97
|
*
|
|
@@ -89,7 +101,7 @@ export declare const Int8: {
|
|
|
89
101
|
* @param max - The maximum value (inclusive)
|
|
90
102
|
* @returns A random `Int8` in `[min, max]`
|
|
91
103
|
*/
|
|
92
|
-
readonly random:
|
|
104
|
+
readonly random: typeof random;
|
|
93
105
|
/**
|
|
94
106
|
* Raises `a` to the power `b`, returning `a ** b` as an `Int8` (floored to an
|
|
95
107
|
* integer).
|
|
@@ -98,7 +110,7 @@ export declare const Int8: {
|
|
|
98
110
|
* @param b - The exponent integer
|
|
99
111
|
* @returns `a ** b` as an `Int8`
|
|
100
112
|
*/
|
|
101
|
-
readonly pow:
|
|
113
|
+
readonly pow: typeof pow;
|
|
102
114
|
/**
|
|
103
115
|
* Adds two integers, returning `a + b` as an `Int8`.
|
|
104
116
|
*
|
|
@@ -106,7 +118,7 @@ export declare const Int8: {
|
|
|
106
118
|
* @param b - The second integer
|
|
107
119
|
* @returns The sum of `a` and `b` as an `Int8`
|
|
108
120
|
*/
|
|
109
|
-
readonly add:
|
|
121
|
+
readonly add: typeof add;
|
|
110
122
|
/**
|
|
111
123
|
* Subtracts two integers, returning `a - b` as an `Int8`.
|
|
112
124
|
*
|
|
@@ -114,7 +126,7 @@ export declare const Int8: {
|
|
|
114
126
|
* @param b - The second integer
|
|
115
127
|
* @returns The difference of `a` and `b` as an `Int8`
|
|
116
128
|
*/
|
|
117
|
-
readonly sub:
|
|
129
|
+
readonly sub: typeof sub;
|
|
118
130
|
/**
|
|
119
131
|
* Multiplies two integers, returning `a * b` as an `Int8`.
|
|
120
132
|
*
|
|
@@ -122,7 +134,7 @@ export declare const Int8: {
|
|
|
122
134
|
* @param b - The second integer
|
|
123
135
|
* @returns The product of `a` and `b` as an `Int8`
|
|
124
136
|
*/
|
|
125
|
-
readonly mul:
|
|
137
|
+
readonly mul: typeof mul;
|
|
126
138
|
/**
|
|
127
139
|
* Divides two integers using floor division (`⌊a / b⌋`): the result is `a /
|
|
128
140
|
* b` rounded toward negative infinity, as an `Int8`.
|
|
@@ -131,6 +143,7 @@ export declare const Int8: {
|
|
|
131
143
|
* @param b - The divisor (must be non-zero)
|
|
132
144
|
* @returns The floored quotient as an `Int8`
|
|
133
145
|
*/
|
|
134
|
-
readonly div:
|
|
146
|
+
readonly div: typeof div;
|
|
135
147
|
};
|
|
148
|
+
export {};
|
|
136
149
|
//# sourceMappingURL=int8.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/int8.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,IAAI,IAAI,gBAAgB,EAC9B,MAAM,e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W,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { type Uint8 as TtfImported_Uint8 } from 'ts-type-forge';
|
|
2
2
|
export type Uint8 = TtfImported_Uint8;
|
|
3
|
+
declare const is: (x: number) => x is Uint8;
|
|
4
|
+
declare const castType: (x: number) => Uint8;
|
|
5
|
+
declare const fromNumber: (a: number) => Uint8;
|
|
6
|
+
declare const min_: (...values: readonly Uint8[]) => Uint8;
|
|
7
|
+
declare const max_: (...values: readonly Uint8[]) => Uint8;
|
|
8
|
+
declare const pow: (x: Uint8, y: Uint8) => Uint8;
|
|
9
|
+
declare const add: (x: Uint8, y: Uint8) => Uint8;
|
|
10
|
+
declare const sub: (x: Uint8, y: Uint8) => Uint8;
|
|
11
|
+
declare const mul: (x: Uint8, y: Uint8) => Uint8;
|
|
12
|
+
declare const div: (x: Uint8, y: Exclude<Uint8, 0>) => Uint8;
|
|
13
|
+
declare const random: (min: Uint8, max: Uint8) => Uint8;
|
|
3
14
|
/**
|
|
4
15
|
* Type guard that checks if a value is an non-negative integer less than 256.
|
|
5
16
|
*
|
|
@@ -9,7 +20,7 @@ export type Uint8 = TtfImported_Uint8;
|
|
|
9
20
|
* @param value - The value to check
|
|
10
21
|
* @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
|
|
11
22
|
*/
|
|
12
|
-
export declare const isUint8:
|
|
23
|
+
export declare const isUint8: typeof is;
|
|
13
24
|
/**
|
|
14
25
|
* Casts a `number` to the `Uint8` branded type.
|
|
15
26
|
*
|
|
@@ -20,7 +31,7 @@ export declare const isUint8: (x: number) => x is Uint8;
|
|
|
20
31
|
* @returns The value as an `Uint8`
|
|
21
32
|
* @throws {TypeError} If the value is not an non-negative integer less than 256
|
|
22
33
|
*/
|
|
23
|
-
export declare const asUint8:
|
|
34
|
+
export declare const asUint8: typeof castType;
|
|
24
35
|
/**
|
|
25
36
|
* Namespace providing type-safe operations for the `Uint8` branded type.
|
|
26
37
|
*
|
|
@@ -35,7 +46,7 @@ export declare const Uint8: {
|
|
|
35
46
|
* @returns `true` if the value is an non-negative integer less than 256, `false` otherwise
|
|
36
47
|
* @see {@link isUint8} for usage examples
|
|
37
48
|
*/
|
|
38
|
-
readonly is:
|
|
49
|
+
readonly is: typeof is;
|
|
39
50
|
/**
|
|
40
51
|
* The smallest value representable as `Uint8` (the lower saturation target of
|
|
41
52
|
* `fromNumber`).
|
|
@@ -52,14 +63,14 @@ export declare const Uint8: {
|
|
|
52
63
|
* @param values - The non-negative integers to compare (at least one required)
|
|
53
64
|
* @returns The largest value as an `Uint8`
|
|
54
65
|
*/
|
|
55
|
-
readonly max:
|
|
66
|
+
readonly max: typeof max_;
|
|
56
67
|
/**
|
|
57
68
|
* Returns the smallest of the given non-negative integers.
|
|
58
69
|
*
|
|
59
70
|
* @param values - The non-negative integers to compare (at least one required)
|
|
60
71
|
* @returns The smallest value as an `Uint8`
|
|
61
72
|
*/
|
|
62
|
-
readonly min:
|
|
73
|
+
readonly min: typeof min_;
|
|
63
74
|
/**
|
|
64
75
|
* Converts an arbitrary `number` into an `Uint8`, rounding to the nearest
|
|
65
76
|
* integer and saturating the result into the range `[MIN_VALUE, MAX_VALUE]`.
|
|
@@ -70,7 +81,7 @@ export declare const Uint8: {
|
|
|
70
81
|
* @param value - The value to convert
|
|
71
82
|
* @returns The value as an `Uint8`
|
|
72
83
|
*/
|
|
73
|
-
readonly fromNumber:
|
|
84
|
+
readonly fromNumber: typeof fromNumber;
|
|
74
85
|
/**
|
|
75
86
|
* Generates a random `Uint8` within the given range.
|
|
76
87
|
*
|
|
@@ -80,7 +91,7 @@ export declare const Uint8: {
|
|
|
80
91
|
* @param max - The maximum value (inclusive)
|
|
81
92
|
* @returns A random `Uint8` in `[min, max]`
|
|
82
93
|
*/
|
|
83
|
-
readonly random:
|
|
94
|
+
readonly random: typeof random;
|
|
84
95
|
/**
|
|
85
96
|
* Raises `a` to the power `b`, returning `a ** b` as an `Uint8` (floored to
|
|
86
97
|
* an integer).
|
|
@@ -89,7 +100,7 @@ export declare const Uint8: {
|
|
|
89
100
|
* @param b - The exponent non-negative integer
|
|
90
101
|
* @returns `a ** b` as an `Uint8`
|
|
91
102
|
*/
|
|
92
|
-
readonly pow:
|
|
103
|
+
readonly pow: typeof pow;
|
|
93
104
|
/**
|
|
94
105
|
* Adds two non-negative integers, returning `a + b` as an `Uint8`.
|
|
95
106
|
*
|
|
@@ -97,7 +108,7 @@ export declare const Uint8: {
|
|
|
97
108
|
* @param b - The second non-negative integer
|
|
98
109
|
* @returns The sum of `a` and `b` as an `Uint8`
|
|
99
110
|
*/
|
|
100
|
-
readonly add:
|
|
111
|
+
readonly add: typeof add;
|
|
101
112
|
/**
|
|
102
113
|
* Subtracts two non-negative integers, returning `a - b` as an `Uint8`.
|
|
103
114
|
*
|
|
@@ -105,7 +116,7 @@ export declare const Uint8: {
|
|
|
105
116
|
* @param b - The second non-negative integer
|
|
106
117
|
* @returns The difference of `a` and `b` as an `Uint8`
|
|
107
118
|
*/
|
|
108
|
-
readonly sub:
|
|
119
|
+
readonly sub: typeof sub;
|
|
109
120
|
/**
|
|
110
121
|
* Multiplies two non-negative integers, returning `a * b` as an `Uint8`.
|
|
111
122
|
*
|
|
@@ -113,7 +124,7 @@ export declare const Uint8: {
|
|
|
113
124
|
* @param b - The second non-negative integer
|
|
114
125
|
* @returns The product of `a` and `b` as an `Uint8`
|
|
115
126
|
*/
|
|
116
|
-
readonly mul:
|
|
127
|
+
readonly mul: typeof mul;
|
|
117
128
|
/**
|
|
118
129
|
* Divides two non-negative integers using floor division (`⌊a / b⌋`): the
|
|
119
130
|
* result is `a / b` rounded toward negative infinity, as an `Uint8`.
|
|
@@ -122,6 +133,7 @@ export declare const Uint8: {
|
|
|
122
133
|
* @param b - The divisor (must be non-zero)
|
|
123
134
|
* @returns The floored quotient as an `Uint8`
|
|
124
135
|
*/
|
|
125
|
-
readonly div:
|
|
136
|
+
readonly div: typeof div;
|
|
126
137
|
};
|
|
138
|
+
export {};
|
|
127
139
|
//# sourceMappingURL=uint8.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAI7E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"uint8.d.mts","sourceRoot":"","sources":["../../../src/number/enum/uint8.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAI7E,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAoBtC,QAAA,MAAM,EAAE,MAAO,MAAM,KAAG,CAAC,IAAI,KAAkB,CAAC;AAEhD,QAAA,MAAM,QAAQ,MAAO,MAAM,KAAG,KAEJ,CAAC;AAE3B,QAAA,MAAM,UAAU,MAAO,MAAM,KAAG,KAAoC,CAAC;AAErE,QAAA,MAAM,IAAI,cAAe,SAAS,KAAK,EAAE,KAAG,KACb,CAAC;AAEhC,QAAA,MAAM,IAAI,cAAe,SAAS,KAAK,EAAE,KAAG,KACb,CAAC;AAEhC,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA2B,CAAC;AAE9D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,KAAK,KAAG,KAA0B,CAAC;AAE7D,QAAA,MAAM,GAAG,MAAO,KAAK,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAG,KACf,CAAC;AAEhC,QAAA,MAAM,MAAM,QAAS,KAAK,OAAO,KAAK,KAAG,KACmB,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,WAAK,CAAC;AAE1B;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,iBAAW,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;OAOG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;OAOG;;CAEK,CAAC"}
|
|
@@ -28,5 +28,5 @@ export declare const ifThen: (antecedent: boolean, consequent: boolean) => boole
|
|
|
28
28
|
* (then part)
|
|
29
29
|
* @returns `true` if the implication holds, `false` otherwise
|
|
30
30
|
*/
|
|
31
|
-
export declare const implies:
|
|
31
|
+
export declare const implies: typeof ifThen;
|
|
32
32
|
//# sourceMappingURL=if-then.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if-then.d.mts","sourceRoot":"","sources":["../../src/others/if-then.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,eAAgB,OAAO,cAAc,OAAO,KAAG,OACvC,CAAC;AAE5B;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"if-then.d.mts","sourceRoot":"","sources":["../../src/others/if-then.mts"],"names":[],"mappings":"AAAA;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;;;;;;;;;;;;;;OAsCG;IACH,SAAgB,qBAAqB,CACnC,CAAC,SAAS,MAAM,EAChB,SAAS,SAAS,eAAe,EACjC,SAAS,SAAS,eAAe,EAEjC,CAAC,EAAE,CAAC,EACJ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACnB,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAGjD,SAAgB,qBAAqB,CACnC,SAAS,SAAS,eAAe,EACjC,SAAS,SAAS,eAAe,EAEjC,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACnB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAoC7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,SAAgB,mBAAmB,CACjC,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS,eAAe,EAC9B,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAGvD,SAAgB,mBAAmB,CAAC,MAAM,SAAS,eAAe,EAChE,MAAM,EAAE,MAAM,GACb,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IA+B7D;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACI,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,KAC5C,CAAC,KACH,cAAc,GAAG,CAMnB,CAAC;CACH"}
|
package/dist/string/str.mjs
CHANGED
|
@@ -6,76 +6,76 @@ var Str;
|
|
|
6
6
|
Str2.isFixedLengthString = (s, length) => s.length === length;
|
|
7
7
|
function asMinLengthString(...args) {
|
|
8
8
|
switch (args.length) {
|
|
9
|
-
case 2:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`Expected a string of length >= ${minLength}, got a string of length ${s.length}`
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
return s;
|
|
17
|
-
}
|
|
18
|
-
case 1: {
|
|
19
|
-
const [minLength] = args;
|
|
20
|
-
return (s) => asMinLengthString(s, minLength);
|
|
21
|
-
}
|
|
9
|
+
case 2:
|
|
10
|
+
return asMinLengthStringImpl(...args);
|
|
11
|
+
case 1:
|
|
12
|
+
return (s) => asMinLengthStringImpl(s, ...args);
|
|
22
13
|
}
|
|
23
14
|
}
|
|
24
15
|
Str2.asMinLengthString = asMinLengthString;
|
|
16
|
+
const asMinLengthStringImpl = (s, minLength) => {
|
|
17
|
+
const actualLength = s.length;
|
|
18
|
+
if (!(0, Str2.isMinLengthString)(s, minLength)) {
|
|
19
|
+
throw new TypeError(
|
|
20
|
+
`Expected a string of length >= ${minLength}, got a string of length ${actualLength}`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return s;
|
|
24
|
+
};
|
|
25
25
|
function asMaxLengthString(...args) {
|
|
26
26
|
switch (args.length) {
|
|
27
|
-
case 2:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`Expected a string of length <= ${maxLength}, got a string of length ${s.length}`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
return s;
|
|
35
|
-
}
|
|
36
|
-
case 1: {
|
|
37
|
-
const [maxLength] = args;
|
|
38
|
-
return (s) => asMaxLengthString(s, maxLength);
|
|
39
|
-
}
|
|
27
|
+
case 2:
|
|
28
|
+
return asMaxLengthStringImpl(...args);
|
|
29
|
+
case 1:
|
|
30
|
+
return (s) => asMaxLengthStringImpl(s, ...args);
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
33
|
Str2.asMaxLengthString = asMaxLengthString;
|
|
34
|
+
const asMaxLengthStringImpl = (s, maxLength) => {
|
|
35
|
+
const actualLength = s.length;
|
|
36
|
+
if (!(0, Str2.isMaxLengthString)(s, maxLength)) {
|
|
37
|
+
throw new TypeError(
|
|
38
|
+
`Expected a string of length <= ${maxLength}, got a string of length ${actualLength}`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return s;
|
|
42
|
+
};
|
|
43
43
|
function asBoundedLengthString(...args) {
|
|
44
44
|
switch (args.length) {
|
|
45
|
-
case 3:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`Expected a string of length in [${minLength}, ${maxLength}], got a string of length ${s.length}`
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return s;
|
|
53
|
-
}
|
|
54
|
-
case 2: {
|
|
55
|
-
const [minLength, maxLength] = args;
|
|
56
|
-
return (s) => asBoundedLengthString(s, minLength, maxLength);
|
|
57
|
-
}
|
|
45
|
+
case 3:
|
|
46
|
+
return asBoundedLengthStringImpl(...args);
|
|
47
|
+
case 2:
|
|
48
|
+
return (s) => asBoundedLengthStringImpl(s, ...args);
|
|
58
49
|
}
|
|
59
50
|
}
|
|
60
51
|
Str2.asBoundedLengthString = asBoundedLengthString;
|
|
52
|
+
const asBoundedLengthStringImpl = (s, minLength, maxLength) => {
|
|
53
|
+
const actualLength = s.length;
|
|
54
|
+
if (!(0, Str2.isBoundedLengthString)(s, minLength, maxLength)) {
|
|
55
|
+
throw new TypeError(
|
|
56
|
+
`Expected a string of length in [${minLength}, ${maxLength}], got a string of length ${actualLength}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return s;
|
|
60
|
+
};
|
|
61
61
|
function asFixedLengthString(...args) {
|
|
62
62
|
switch (args.length) {
|
|
63
|
-
case 2:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`Expected a string of length ${length}, got a string of length ${s.length}`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
return s;
|
|
71
|
-
}
|
|
72
|
-
case 1: {
|
|
73
|
-
const [length] = args;
|
|
74
|
-
return (s) => asFixedLengthString(s, length);
|
|
75
|
-
}
|
|
63
|
+
case 2:
|
|
64
|
+
return asFixedLengthStringImpl(...args);
|
|
65
|
+
case 1:
|
|
66
|
+
return (s) => asFixedLengthStringImpl(s, ...args);
|
|
76
67
|
}
|
|
77
68
|
}
|
|
78
69
|
Str2.asFixedLengthString = asFixedLengthString;
|
|
70
|
+
const asFixedLengthStringImpl = (s, length) => {
|
|
71
|
+
const actualLength = s.length;
|
|
72
|
+
if (!(0, Str2.isFixedLengthString)(s, length)) {
|
|
73
|
+
throw new TypeError(
|
|
74
|
+
`Expected a string of length ${length}, got a string of length ${actualLength}`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return s;
|
|
78
|
+
};
|
|
79
79
|
Str2.asNonEmptyString = (s) => {
|
|
80
80
|
if (!(0, Str2.isMinLengthString)(s, 1)) {
|
|
81
81
|
throw new TypeError("Expected a non-empty string, got an empty string");
|
package/dist/string/str.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"str.mjs","sources":["../../src/string/str.mts"],"sourcesContent":["import {\n type BoundedLengthString,\n type FixedLengthString,\n type MaxLengthString,\n type MinLengthString,\n type NonEmptyString,\n type SupportedLength,\n} from 'ts-type-forge';\n\n/**\n * Namespace providing type guards and runtime-checked casts for the branded\n * length-constrained string types (`MinLengthString`, `MaxLengthString`,\n * `BoundedLengthString`, `FixedLengthString`).\n *\n * Lengths are measured in UTF-16 code units (the same unit as\n * `String.prototype.length`), so characters outside the Basic Multilingual\n * Plane (e.g. emoji) count as 2.\n */\nexport namespace Str {\n /**\n * Type guard that checks if a string has at least `minLength` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `MinLengthString<MinLength>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - The result participates in the length-constraint subtyping relation: for\n * example, a value narrowed to `MinLengthString<3>` is assignable to\n * `MinLengthString<1>` (= `NonEmptyString`).\n *\n * @example\n *\n * ```ts\n * const input: string = 'very-secret-password';\n *\n * assert.isTrue(Str.isMinLengthString(input, 12));\n *\n * assert.isFalse(Str.isMinLengthString('short', 12));\n *\n * if (Str.isMinLengthString(input, 12)) {\n * const nonEmpty: NonEmptyString = input; // OK (12 >= 1)\n *\n * assert.isTrue(nonEmpty.length >= 12);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @param s - The string to check.\n * @param minLength - The minimum number of characters (inclusive).\n * @returns `true` if `s.length >= minLength`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `MinLengthString<MinLength> & S`.\n */\n export const isMinLengthString = <\n S extends string,\n MinLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n ): s is MinLengthString<MinLength> & S => s.length >= minLength;\n\n /**\n * Type guard that checks if a string has at most `maxLength` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `MaxLengthString<MaxLength>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - The result participates in the length-constraint subtyping relation: for\n * example, a value narrowed to `MaxLengthString<16>` is assignable to\n * `MaxLengthString<32>`.\n *\n * @example\n *\n * ```ts\n * const input: string = 'noshiro';\n *\n * assert.isTrue(Str.isMaxLengthString(input, 32));\n *\n * assert.isFalse(Str.isMaxLengthString(input, 3));\n *\n * if (Str.isMaxLengthString(input, 32)) {\n * const relaxed: MaxLengthString<64> = input; // OK (32 <= 64)\n *\n * assert.isTrue(relaxed.length <= 32);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to check.\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `true` if `s.length <= maxLength`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `MaxLengthString<MaxLength> & S`.\n */\n export const isMaxLengthString = <\n S extends string,\n MaxLength extends SupportedLength,\n >(\n s: S,\n maxLength: MaxLength,\n ): s is MaxLengthString<MaxLength> & S => s.length <= maxLength;\n\n /**\n * Type guard that checks if a string's length is within the inclusive range\n * `[minLength, maxLength]`.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `BoundedLengthString<MinLength, MaxLength>` while\n * preserving the original string type (e.g. literal types) via intersection.\n * - Since `BoundedLengthString` is the intersection of `MinLengthString` and\n * `MaxLengthString`, the narrowed value is assignable to both, and both\n * bounds can be weakened independently.\n *\n * @example\n *\n * ```ts\n * const input: string = 'user-12345678';\n *\n * assert.isTrue(Str.isBoundedLengthString(input, 8, 16));\n *\n * assert.isFalse(Str.isBoundedLengthString('user', 8, 16));\n *\n * if (Str.isBoundedLengthString(input, 8, 16)) {\n * const userId: BoundedLengthString<1, 255> = input; // OK ([8, 16] ⊆ [1, 255])\n *\n * assert.isTrue(userId.length >= 8 && userId.length <= 16);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to check.\n * @param minLength - The minimum number of characters (inclusive).\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `true` if `minLength <= s.length && s.length <= maxLength`, `false`\n * otherwise. When `true`, TypeScript narrows `s` to\n * `BoundedLengthString<MinLength, MaxLength> & S`.\n */\n export const isBoundedLengthString = <\n S extends string,\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n maxLength: MaxLength,\n ): s is BoundedLengthString<MinLength, MaxLength> & S =>\n s.length >= minLength && s.length <= maxLength;\n\n /**\n * Type guard that checks if a string has exactly `length` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `FixedLengthString<Length>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - Since `FixedLengthString<Length>` is defined as\n * `BoundedLengthString<Length, Length>`, the narrowed value is assignable to\n * any `MinLengthString<N>` with `N <= Length` and any `MaxLengthString<N>`\n * with `N >= Length`.\n *\n * @example\n *\n * ```ts\n * const input: string = 'JP';\n *\n * assert.isTrue(Str.isFixedLengthString(input, 2));\n *\n * assert.isFalse(Str.isFixedLengthString(input, 3));\n *\n * if (Str.isFixedLengthString(input, 2)) {\n * const atMost5: MaxLengthString<5> = input; // OK (2 <= 5)\n *\n * assert.isTrue(atMost5.length === 2);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template Length - The exact number of characters.\n * @param s - The string to check.\n * @param length - The exact number of characters.\n * @returns `true` if `s.length === length`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `FixedLengthString<Length> & S`.\n */\n export const isFixedLengthString = <\n S extends string,\n Length extends SupportedLength,\n >(\n s: S,\n length: Length,\n ): s is FixedLengthString<Length> & S => s.length === length;\n\n /**\n * Casts a string to `MinLengthString<MinLength>` after checking that it has\n * at least `minLength` characters.\n *\n * Use this instead of writing `s as unknown as MinLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `minLength` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const password = Str.asMinLengthString('very-secret-password', 12);\n *\n * const nonEmpty: NonEmptyString = password; // OK (>= 1)\n *\n * assert.isTrue(nonEmpty.length >= 12);\n *\n * // curried version\n * const asPassword = Str.asMinLengthString(12);\n *\n * assert.strictEqual(asPassword('another-secret'), 'another-secret');\n *\n * assert.throws(() => Str.asMinLengthString('short', 12)); // length 5 < 12\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @param s - The string to cast.\n * @param minLength - The minimum number of characters (inclusive).\n * @returns `s` typed as `MinLengthString<MinLength> & S`.\n * @throws {TypeError} If `s.length < minLength`.\n */\n export function asMinLengthString<\n S extends string,\n MinLength extends SupportedLength,\n >(s: S, minLength: MinLength): MinLengthString<MinLength> & S;\n\n // Curried version\n export function asMinLengthString<MinLength extends SupportedLength>(\n minLength: MinLength,\n ): <S extends string>(s: S) => MinLengthString<MinLength> & S;\n\n export function asMinLengthString(\n ...args:\n | readonly [s: string, minLength: SupportedLength]\n | readonly [minLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2: {\n const [s, minLength] = args;\n\n if (!isMinLengthString(s, minLength)) {\n throw new TypeError(\n `Expected a string of length >= ${minLength}, got a string of length ${s.length}`,\n );\n }\n\n return s;\n }\n\n case 1: {\n const [minLength] = args;\n\n return (s) => asMinLengthString(s, minLength);\n }\n }\n }\n\n /**\n * Casts a string to `MaxLengthString<MaxLength>` after checking that it has\n * at most `maxLength` characters.\n *\n * Use this instead of writing `s as unknown as MaxLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `maxLength` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const userName = Str.asMaxLengthString('noshiro', 32);\n *\n * const relaxed: MaxLengthString<64> = userName; // OK (32 <= 64)\n *\n * assert.isTrue(relaxed.length <= 32);\n *\n * // curried version\n * const asUserName = Str.asMaxLengthString(32);\n *\n * assert.strictEqual(asUserName('another-user'), 'another-user');\n *\n * assert.throws(() => Str.asMaxLengthString('noshiro', 3)); // length 7 > 3\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to cast.\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `s` typed as `MaxLengthString<MaxLength> & S`.\n * @throws {TypeError} If `s.length > maxLength`.\n */\n export function asMaxLengthString<\n S extends string,\n MaxLength extends SupportedLength,\n >(s: S, maxLength: MaxLength): MaxLengthString<MaxLength> & S;\n\n // Curried version\n export function asMaxLengthString<MaxLength extends SupportedLength>(\n maxLength: MaxLength,\n ): <S extends string>(s: S) => MaxLengthString<MaxLength> & S;\n\n export function asMaxLengthString(\n ...args:\n | readonly [s: string, maxLength: SupportedLength]\n | readonly [maxLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2: {\n const [s, maxLength] = args;\n\n if (!isMaxLengthString(s, maxLength)) {\n throw new TypeError(\n `Expected a string of length <= ${maxLength}, got a string of length ${s.length}`,\n );\n }\n\n return s;\n }\n\n case 1: {\n const [maxLength] = args;\n\n return (s) => asMaxLengthString(s, maxLength);\n }\n }\n }\n\n /**\n * Casts a string to `BoundedLengthString<MinLength, MaxLength>` after\n * checking that its length is within the inclusive range\n * `[minLength, maxLength]`.\n *\n * Use this instead of writing `s as unknown as BoundedLengthString<M, N>`:\n * the length is verified at runtime, and the original string type (e.g.\n * literal types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `minLength` and\n * `maxLength` returns a function that casts a string, which is convenient for\n * `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const userId = Str.asBoundedLengthString('user-12345678', 8, 16);\n *\n * const relaxed: BoundedLengthString<1, 255> = userId; // OK ([8, 16] ⊆ [1, 255])\n *\n * assert.isTrue(relaxed.length >= 8 && relaxed.length <= 16);\n *\n * // curried version\n * const asUserId = Str.asBoundedLengthString(8, 16);\n *\n * assert.strictEqual(asUserId('user-87654321'), 'user-87654321');\n *\n * assert.throws(() => Str.asBoundedLengthString('user', 8, 16)); // length 4 < 8\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to cast.\n * @param minLength - The minimum number of characters (inclusive).\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `s` typed as `BoundedLengthString<MinLength, MaxLength> & S`.\n * @throws {TypeError} If `s.length < minLength` or `s.length > maxLength`.\n */\n export function asBoundedLengthString<\n S extends string,\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n maxLength: MaxLength,\n ): BoundedLengthString<MinLength, MaxLength> & S;\n\n // Curried version\n export function asBoundedLengthString<\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n minLength: MinLength,\n maxLength: MaxLength,\n ): <S extends string>(s: S) => BoundedLengthString<MinLength, MaxLength> & S;\n\n export function asBoundedLengthString(\n ...args:\n | readonly [\n s: string,\n minLength: SupportedLength,\n maxLength: SupportedLength,\n ]\n | readonly [minLength: SupportedLength, maxLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 3: {\n const [s, minLength, maxLength] = args;\n\n if (!isBoundedLengthString(s, minLength, maxLength)) {\n throw new TypeError(\n `Expected a string of length in [${minLength}, ${maxLength}], got a string of length ${s.length}`,\n );\n }\n\n return s;\n }\n\n case 2: {\n const [minLength, maxLength] = args;\n\n return (s) => asBoundedLengthString(s, minLength, maxLength);\n }\n }\n }\n\n /**\n * Casts a string to `FixedLengthString<Length>` after checking that it has\n * exactly `length` characters.\n *\n * Use this instead of writing `s as unknown as FixedLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `length` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const countryCode = Str.asFixedLengthString('JP', 2);\n *\n * const atMost5: MaxLengthString<5> = countryCode; // OK (2 <= 5)\n *\n * assert.isTrue(atMost5.length === 2);\n *\n * // curried version\n * const asCountryCode = Str.asFixedLengthString(2);\n *\n * assert.strictEqual(asCountryCode('US'), 'US');\n *\n * assert.throws(() => Str.asFixedLengthString('JP', 3)); // length 2 !== 3\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template Length - The exact number of characters.\n * @param s - The string to cast.\n * @param length - The exact number of characters.\n * @returns `s` typed as `FixedLengthString<Length> & S`.\n * @throws {TypeError} If `s.length !== length`.\n */\n export function asFixedLengthString<\n S extends string,\n Length extends SupportedLength,\n >(s: S, length: Length): FixedLengthString<Length> & S;\n\n // Curried version\n export function asFixedLengthString<Length extends SupportedLength>(\n length: Length,\n ): <S extends string>(s: S) => FixedLengthString<Length> & S;\n\n export function asFixedLengthString(\n ...args:\n | readonly [s: string, length: SupportedLength]\n | readonly [length: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2: {\n const [s, length] = args;\n\n if (!isFixedLengthString(s, length)) {\n throw new TypeError(\n `Expected a string of length ${length}, got a string of length ${s.length}`,\n );\n }\n\n return s;\n }\n\n case 1: {\n const [length] = args;\n\n return (s) => asFixedLengthString(s, length);\n }\n }\n }\n\n /**\n * Casts a string to `NonEmptyString` after checking that it has at least one\n * character.\n *\n * `NonEmptyString` is an alias of `MinLengthString<1>`, so this is the\n * length-1 specialization of {@link asMinLengthString}. Use this instead of\n * writing `s as unknown as NonEmptyString`: the length is verified at\n * runtime, and the original string type (e.g. literal types) is preserved\n * via intersection.\n *\n * @example\n *\n * ```ts\n * const name = Str.asNonEmptyString('noshiro');\n *\n * const nonEmpty: NonEmptyString = name; // OK\n *\n * assert.isTrue(nonEmpty.length >= 1);\n *\n * assert.throws(() => Str.asNonEmptyString('')); // length 0 < 1\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @param s - The string to cast.\n * @returns `s` typed as `NonEmptyString & S`.\n * @throws {TypeError} If `s` is empty.\n */\n export const asNonEmptyString = <S extends string>(\n s: S,\n ): NonEmptyString & S => {\n if (!isMinLengthString(s, 1)) {\n throw new TypeError('Expected a non-empty string, got an empty string');\n }\n\n return s;\n };\n}\n"],"names":["Str"],"mappings":"AAkBO,IAAU;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAmCE,EAAMA,KAAA,iBAAA,GAAoB,CAI/B,CAAA,EACA,SAAA,KACwC,EAAE,MAAA,IAAU,SAAA;AAoC/C,EAAMA,KAAA,iBAAA,GAAoB,CAI/B,CAAA,EACA,SAAA,KACwC,EAAE,MAAA,IAAU,SAAA;AAwC/C,EAAMA,IAAAA,CAAA,qBAAA,GAAwB,CAKnC,CAAA,EACA,SAAA,EACA,cAEA,CAAA,CAAE,MAAA,IAAU,SAAA,IAAa,CAAA,CAAE,MAAA,IAAU,SAAA;AAqChC,EAAMA,KAAA,mBAAA,GAAsB,CAIjC,CAAA,EACA,MAAA,KACuC,EAAE,MAAA,KAAW,MAAA;A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CAAA,GAAI,IAAA;AAEjB,QAAA,OAAO,CAAC,CAAA,KAAM,mBAAA,CAAoB,CAAA,EAAG,MAAM,CAAA;AAAA,MAC7C;AAAA;AACF,EACF;AAxBO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAqDT,EAAMA,IAAAA,CAAA,gBAAA,GAAmB,CAC9B,CAAA,KACuB;AACvB,IAAA,IAAI,CAAA,IAACA,IAAAA,CAAA,iBAAA,EAAkB,CAAA,EAAG,CAAC,CAAA,EAAG;AAC5B,MAAA,MAAM,IAAI,UAAU,kDAAkD,CAAA;AAAA,IACxE;AAEA,IAAA,OAAO,CAAA;AAAA,EACT,CAAA;AAAA,CAAA,EAjgBe,GAAA,KAAA,GAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"str.mjs","sources":["../../src/string/str.mts"],"sourcesContent":["import {\n type BoundedLengthString,\n type FixedLengthString,\n type MaxLengthString,\n type MinLengthString,\n type NonEmptyString,\n type SupportedLength,\n} from 'ts-type-forge';\n\n/**\n * Namespace providing type guards and runtime-checked casts for the branded\n * length-constrained string types (`MinLengthString`, `MaxLengthString`,\n * `BoundedLengthString`, `FixedLengthString`).\n *\n * Lengths are measured in UTF-16 code units (the same unit as\n * `String.prototype.length`), so characters outside the Basic Multilingual\n * Plane (e.g. emoji) count as 2.\n */\nexport namespace Str {\n /**\n * Type guard that checks if a string has at least `minLength` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `MinLengthString<MinLength>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - The result participates in the length-constraint subtyping relation: for\n * example, a value narrowed to `MinLengthString<3>` is assignable to\n * `MinLengthString<1>` (= `NonEmptyString`).\n *\n * @example\n *\n * ```ts\n * const input: string = 'very-secret-password';\n *\n * assert.isTrue(Str.isMinLengthString(input, 12));\n *\n * assert.isFalse(Str.isMinLengthString('short', 12));\n *\n * if (Str.isMinLengthString(input, 12)) {\n * const nonEmpty: NonEmptyString = input; // OK (12 >= 1)\n *\n * assert.isTrue(nonEmpty.length >= 12);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @param s - The string to check.\n * @param minLength - The minimum number of characters (inclusive).\n * @returns `true` if `s.length >= minLength`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `MinLengthString<MinLength> & S`.\n */\n export const isMinLengthString = <\n S extends string,\n MinLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n ): s is MinLengthString<MinLength> & S => s.length >= minLength;\n\n /**\n * Type guard that checks if a string has at most `maxLength` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `MaxLengthString<MaxLength>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - The result participates in the length-constraint subtyping relation: for\n * example, a value narrowed to `MaxLengthString<16>` is assignable to\n * `MaxLengthString<32>`.\n *\n * @example\n *\n * ```ts\n * const input: string = 'noshiro';\n *\n * assert.isTrue(Str.isMaxLengthString(input, 32));\n *\n * assert.isFalse(Str.isMaxLengthString(input, 3));\n *\n * if (Str.isMaxLengthString(input, 32)) {\n * const relaxed: MaxLengthString<64> = input; // OK (32 <= 64)\n *\n * assert.isTrue(relaxed.length <= 32);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to check.\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `true` if `s.length <= maxLength`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `MaxLengthString<MaxLength> & S`.\n */\n export const isMaxLengthString = <\n S extends string,\n MaxLength extends SupportedLength,\n >(\n s: S,\n maxLength: MaxLength,\n ): s is MaxLengthString<MaxLength> & S => s.length <= maxLength;\n\n /**\n * Type guard that checks if a string's length is within the inclusive range\n * `[minLength, maxLength]`.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `BoundedLengthString<MinLength, MaxLength>` while\n * preserving the original string type (e.g. literal types) via intersection.\n * - Since `BoundedLengthString` is the intersection of `MinLengthString` and\n * `MaxLengthString`, the narrowed value is assignable to both, and both\n * bounds can be weakened independently.\n *\n * @example\n *\n * ```ts\n * const input: string = 'user-12345678';\n *\n * assert.isTrue(Str.isBoundedLengthString(input, 8, 16));\n *\n * assert.isFalse(Str.isBoundedLengthString('user', 8, 16));\n *\n * if (Str.isBoundedLengthString(input, 8, 16)) {\n * const userId: BoundedLengthString<1, 255> = input; // OK ([8, 16] ⊆ [1, 255])\n *\n * assert.isTrue(userId.length >= 8 && userId.length <= 16);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to check.\n * @param minLength - The minimum number of characters (inclusive).\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `true` if `minLength <= s.length && s.length <= maxLength`, `false`\n * otherwise. When `true`, TypeScript narrows `s` to\n * `BoundedLengthString<MinLength, MaxLength> & S`.\n */\n export const isBoundedLengthString = <\n S extends string,\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n maxLength: MaxLength,\n ): s is BoundedLengthString<MinLength, MaxLength> & S =>\n s.length >= minLength && s.length <= maxLength;\n\n /**\n * Type guard that checks if a string has exactly `length` characters.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input to `FixedLengthString<Length>` while preserving the\n * original string type (e.g. literal types) via intersection.\n * - Since `FixedLengthString<Length>` is defined as\n * `BoundedLengthString<Length, Length>`, the narrowed value is assignable to\n * any `MinLengthString<N>` with `N <= Length` and any `MaxLengthString<N>`\n * with `N >= Length`.\n *\n * @example\n *\n * ```ts\n * const input: string = 'JP';\n *\n * assert.isTrue(Str.isFixedLengthString(input, 2));\n *\n * assert.isFalse(Str.isFixedLengthString(input, 3));\n *\n * if (Str.isFixedLengthString(input, 2)) {\n * const atMost5: MaxLengthString<5> = input; // OK (2 <= 5)\n *\n * assert.isTrue(atMost5.length === 2);\n * }\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template Length - The exact number of characters.\n * @param s - The string to check.\n * @param length - The exact number of characters.\n * @returns `true` if `s.length === length`, `false` otherwise. When `true`,\n * TypeScript narrows `s` to `FixedLengthString<Length> & S`.\n */\n export const isFixedLengthString = <\n S extends string,\n Length extends SupportedLength,\n >(\n s: S,\n length: Length,\n ): s is FixedLengthString<Length> & S => s.length === length;\n\n /**\n * Casts a string to `MinLengthString<MinLength>` after checking that it has\n * at least `minLength` characters.\n *\n * Use this instead of writing `s as unknown as MinLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `minLength` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const password = Str.asMinLengthString('very-secret-password', 12);\n *\n * const nonEmpty: NonEmptyString = password; // OK (>= 1)\n *\n * assert.isTrue(nonEmpty.length >= 12);\n *\n * // curried version\n * const asPassword = Str.asMinLengthString(12);\n *\n * assert.strictEqual(asPassword('another-secret'), 'another-secret');\n *\n * assert.throws(() => Str.asMinLengthString('short', 12)); // length 5 < 12\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @param s - The string to cast.\n * @param minLength - The minimum number of characters (inclusive).\n * @returns `s` typed as `MinLengthString<MinLength> & S`.\n * @throws {TypeError} If `s.length < minLength`.\n */\n export function asMinLengthString<\n S extends string,\n MinLength extends SupportedLength,\n >(s: S, minLength: MinLength): MinLengthString<MinLength> & S;\n\n // Curried version\n export function asMinLengthString<MinLength extends SupportedLength>(\n minLength: MinLength,\n ): <S extends string>(s: S) => MinLengthString<MinLength> & S;\n\n export function asMinLengthString(\n ...args:\n | readonly [s: string, minLength: SupportedLength]\n | readonly [minLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2:\n return asMinLengthStringImpl(...args);\n\n case 1:\n return (s) => asMinLengthStringImpl(s, ...args);\n }\n }\n\n const asMinLengthStringImpl = (\n s: string,\n minLength: SupportedLength,\n ): string => {\n const actualLength = s.length;\n\n if (!isMinLengthString(s, minLength)) {\n throw new TypeError(\n `Expected a string of length >= ${minLength}, got a string of length ${actualLength}`,\n );\n }\n\n return s;\n };\n\n /**\n * Casts a string to `MaxLengthString<MaxLength>` after checking that it has\n * at most `maxLength` characters.\n *\n * Use this instead of writing `s as unknown as MaxLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `maxLength` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const userName = Str.asMaxLengthString('noshiro', 32);\n *\n * const relaxed: MaxLengthString<64> = userName; // OK (32 <= 64)\n *\n * assert.isTrue(relaxed.length <= 32);\n *\n * // curried version\n * const asUserName = Str.asMaxLengthString(32);\n *\n * assert.strictEqual(asUserName('another-user'), 'another-user');\n *\n * assert.throws(() => Str.asMaxLengthString('noshiro', 3)); // length 7 > 3\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to cast.\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `s` typed as `MaxLengthString<MaxLength> & S`.\n * @throws {TypeError} If `s.length > maxLength`.\n */\n export function asMaxLengthString<\n S extends string,\n MaxLength extends SupportedLength,\n >(s: S, maxLength: MaxLength): MaxLengthString<MaxLength> & S;\n\n // Curried version\n export function asMaxLengthString<MaxLength extends SupportedLength>(\n maxLength: MaxLength,\n ): <S extends string>(s: S) => MaxLengthString<MaxLength> & S;\n\n export function asMaxLengthString(\n ...args:\n | readonly [s: string, maxLength: SupportedLength]\n | readonly [maxLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2:\n return asMaxLengthStringImpl(...args);\n\n case 1:\n return (s) => asMaxLengthStringImpl(s, ...args);\n }\n }\n\n const asMaxLengthStringImpl = (\n s: string,\n maxLength: SupportedLength,\n ): string => {\n const actualLength = s.length;\n\n if (!isMaxLengthString(s, maxLength)) {\n throw new TypeError(\n `Expected a string of length <= ${maxLength}, got a string of length ${actualLength}`,\n );\n }\n\n return s;\n };\n\n /**\n * Casts a string to `BoundedLengthString<MinLength, MaxLength>` after\n * checking that its length is within the inclusive range\n * `[minLength, maxLength]`.\n *\n * Use this instead of writing `s as unknown as BoundedLengthString<M, N>`:\n * the length is verified at runtime, and the original string type (e.g.\n * literal types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `minLength` and\n * `maxLength` returns a function that casts a string, which is convenient for\n * `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const userId = Str.asBoundedLengthString('user-12345678', 8, 16);\n *\n * const relaxed: BoundedLengthString<1, 255> = userId; // OK ([8, 16] ⊆ [1, 255])\n *\n * assert.isTrue(relaxed.length >= 8 && relaxed.length <= 16);\n *\n * // curried version\n * const asUserId = Str.asBoundedLengthString(8, 16);\n *\n * assert.strictEqual(asUserId('user-87654321'), 'user-87654321');\n *\n * assert.throws(() => Str.asBoundedLengthString('user', 8, 16)); // length 4 < 8\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template MinLength - The minimum number of characters (inclusive).\n * @template MaxLength - The maximum number of characters (inclusive).\n * @param s - The string to cast.\n * @param minLength - The minimum number of characters (inclusive).\n * @param maxLength - The maximum number of characters (inclusive).\n * @returns `s` typed as `BoundedLengthString<MinLength, MaxLength> & S`.\n * @throws {TypeError} If `s.length < minLength` or `s.length > maxLength`.\n */\n export function asBoundedLengthString<\n S extends string,\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n s: S,\n minLength: MinLength,\n maxLength: MaxLength,\n ): BoundedLengthString<MinLength, MaxLength> & S;\n\n // Curried version\n export function asBoundedLengthString<\n MinLength extends SupportedLength,\n MaxLength extends SupportedLength,\n >(\n minLength: MinLength,\n maxLength: MaxLength,\n ): <S extends string>(s: S) => BoundedLengthString<MinLength, MaxLength> & S;\n\n export function asBoundedLengthString(\n ...args:\n | readonly [\n s: string,\n minLength: SupportedLength,\n maxLength: SupportedLength,\n ]\n | readonly [minLength: SupportedLength, maxLength: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 3:\n return asBoundedLengthStringImpl(...args);\n\n case 2:\n return (s) => asBoundedLengthStringImpl(s, ...args);\n }\n }\n\n const asBoundedLengthStringImpl = (\n s: string,\n minLength: SupportedLength,\n maxLength: SupportedLength,\n ): string => {\n const actualLength = s.length;\n\n if (!isBoundedLengthString(s, minLength, maxLength)) {\n throw new TypeError(\n `Expected a string of length in [${minLength}, ${maxLength}], got a string of length ${actualLength}`,\n );\n }\n\n return s;\n };\n\n /**\n * Casts a string to `FixedLengthString<Length>` after checking that it has\n * exactly `length` characters.\n *\n * Use this instead of writing `s as unknown as FixedLengthString<N>`: the\n * length is verified at runtime, and the original string type (e.g. literal\n * types) is preserved via intersection.\n *\n * Supports a curried overload: calling it with only `length` returns a\n * function that casts a string, which is convenient for `pipe`/`map`.\n *\n * @example\n *\n * ```ts\n * const countryCode = Str.asFixedLengthString('JP', 2);\n *\n * const atMost5: MaxLengthString<5> = countryCode; // OK (2 <= 5)\n *\n * assert.isTrue(atMost5.length === 2);\n *\n * // curried version\n * const asCountryCode = Str.asFixedLengthString(2);\n *\n * assert.strictEqual(asCountryCode('US'), 'US');\n *\n * assert.throws(() => Str.asFixedLengthString('JP', 3)); // length 2 !== 3\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @template Length - The exact number of characters.\n * @param s - The string to cast.\n * @param length - The exact number of characters.\n * @returns `s` typed as `FixedLengthString<Length> & S`.\n * @throws {TypeError} If `s.length !== length`.\n */\n export function asFixedLengthString<\n S extends string,\n Length extends SupportedLength,\n >(s: S, length: Length): FixedLengthString<Length> & S;\n\n // Curried version\n export function asFixedLengthString<Length extends SupportedLength>(\n length: Length,\n ): <S extends string>(s: S) => FixedLengthString<Length> & S;\n\n export function asFixedLengthString(\n ...args:\n | readonly [s: string, length: SupportedLength]\n | readonly [length: SupportedLength]\n ): string | ((s: string) => string) {\n switch (args.length) {\n case 2:\n return asFixedLengthStringImpl(...args);\n\n case 1:\n return (s) => asFixedLengthStringImpl(s, ...args);\n }\n }\n\n const asFixedLengthStringImpl = (\n s: string,\n length: SupportedLength,\n ): string => {\n const actualLength = s.length;\n\n if (!isFixedLengthString(s, length)) {\n throw new TypeError(\n `Expected a string of length ${length}, got a string of length ${actualLength}`,\n );\n }\n\n return s;\n };\n\n /**\n * Casts a string to `NonEmptyString` after checking that it has at least one\n * character.\n *\n * `NonEmptyString` is an alias of `MinLengthString<1>`, so this is the\n * length-1 specialization of {@link asMinLengthString}. Use this instead of\n * writing `s as unknown as NonEmptyString`: the length is verified at\n * runtime, and the original string type (e.g. literal types) is preserved\n * via intersection.\n *\n * @example\n *\n * ```ts\n * const name = Str.asNonEmptyString('noshiro');\n *\n * const nonEmpty: NonEmptyString = name; // OK\n *\n * assert.isTrue(nonEmpty.length >= 1);\n *\n * assert.throws(() => Str.asNonEmptyString('')); // length 0 < 1\n * ```\n *\n * @template S - The input string type (literal types are preserved).\n * @param s - The string to cast.\n * @returns `s` typed as `NonEmptyString & S`.\n * @throws {TypeError} If `s` is empty.\n */\n export const asNonEmptyString = <S extends string>(\n s: S,\n ): NonEmptyString & S => {\n if (!isMinLengthString(s, 1)) {\n throw new TypeError('Expected a non-empty string, got an empty string');\n }\n\n return s;\n };\n}\n"],"names":["Str"],"mappings":"AAkBO,IAAU;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAmCE,EAAMA,KAAA,iBAAA,GAAoB,CAI/B,CAAA,EACA,SAAA,KACwC,EAAE,MAAA,IAAU,SAAA;AAoC/C,EAAMA,KAAA,iBAAA,GAAoB,CAI/B,CAAA,EACA,SAAA,KACwC,EAAE,MAAA,IAAU,SAAA;AAwC/C,EAAMA,IAAAA,CAAA,qBAAA,GAAwB,CAKnC,CAAA,EACA,SAAA,EACA,cAEA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