@avstantso/ts 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +3 -3
  3. package/dist/_global/_register.d.ts +0 -80
  4. package/dist/_global/array/_register.d.ts +0 -28
  5. package/dist/_global/array/arr-n.d.ts +0 -21
  6. package/dist/_global/array/create.d.ts +0 -59
  7. package/dist/_global/array/derivative.d.ts +0 -197
  8. package/dist/_global/array/find.d.ts +0 -89
  9. package/dist/_global/array/index.d.ts +0 -8
  10. package/dist/_global/array/low-level.d.ts +0 -84
  11. package/dist/_global/array/map-key-value.d.ts +0 -121
  12. package/dist/_global/array/min-max-sort.d.ts +0 -244
  13. package/dist/_global/ascii.d.ts +0 -76
  14. package/dist/_global/boolean.d.ts +0 -74
  15. package/dist/_global/comparisons.d.ts +0 -85
  16. package/dist/_global/func.d.ts +0 -17
  17. package/dist/_global/index.d.ts +0 -14
  18. package/dist/_global/literal.d.ts +0 -180
  19. package/dist/_global/numeric/domain/describes.d.ts +0 -62
  20. package/dist/_global/numeric/domain/generated.d.ts +0 -11240
  21. package/dist/_global/numeric/domain/inc-dec.d.ts +0 -52
  22. package/dist/_global/numeric/domain/independent.d.ts +0 -203
  23. package/dist/_global/numeric/domain/index.d.ts +0 -4
  24. package/dist/_global/numeric/inc-dec.d.ts +0 -50
  25. package/dist/_global/numeric/index.d.ts +0 -3
  26. package/dist/_global/numeric/math.d.ts +0 -257
  27. package/dist/_global/resolve.d.ts +0 -45
  28. package/dist/_global/string.d.ts +0 -306
  29. package/dist/_global/structure/_register.d.ts +0 -93
  30. package/dist/_global/structure/index.d.ts +0 -2
  31. package/dist/_global/structure/structure.d.ts +0 -289
  32. package/dist/_global/type/_register.d.ts +0 -64
  33. package/dist/_global/type/def.d.ts +0 -47
  34. package/dist/_global/type/index.d.ts +0 -7
  35. package/dist/_global/type/key-arr-def.d.ts +0 -14
  36. package/dist/_global/type/key-def.d.ts +0 -76
  37. package/dist/_global/type/key-literal-default-arr.d.ts +0 -45
  38. package/dist/_global/type/not.d.ts +0 -44
  39. package/dist/_global/type/union.d.ts +0 -33
  40. package/dist/_global/union.d.ts +0 -79
  41. package/dist/_global/utility/alt.d.ts +0 -58
  42. package/dist/_global/utility/flat.d.ts +0 -60
  43. package/dist/_global/utility/if-def.d.ts +0 -22
  44. package/dist/_global/utility/index.d.ts +0 -9
  45. package/dist/_global/utility/merge.d.ts +0 -29
  46. package/dist/_global/utility/opaque.d.ts +0 -17
  47. package/dist/_global/utility/options.d.ts +0 -34
  48. package/dist/_global/utility/override.d.ts +0 -100
  49. package/dist/_global/utility/replace-key.d.ts +0 -33
  50. package/dist/_global/utility/required-optional.d.ts +0 -24
  51. package/dist/_std-ext/index.d.ts +0 -1
  52. package/dist/_std-ext/object.d.ts +0 -23
  53. package/dist/export.d.ts +0 -2
  54. package/dist/index.d.ts +0 -4
  55. package/dist/index.js +0 -480
  56. package/dist/index.js.map +0 -1
@@ -1,121 +0,0 @@
1
- declare namespace AVStantso.TS.Array {
2
- /**
3
- * @summary Calculate key by array of keys.
4
- * @template TArr Array of keys
5
- * @returns Key that includes all array items
6
- * @example
7
- * type n = CheckType<ToKey<never>, never>;
8
- * type u = CheckType<ToKey<undefined>, unknown>;
9
- *
10
- * type k0 = CheckType<ToKey<[]>, never>;
11
- * type k1 = CheckType<ToKey<['a']>, 'a'>;
12
- * type k2 = CheckType<ToKey<['a', 1]>, 'a' | 1>;
13
- * type rk2 = CheckType<ToKey<readonly ['a', 1]>, 'a' | 1>;
14
- */
15
- export type ToKey<TArr extends readonly Key[]> = TArr[number];
16
- /**
17
- * @summary Calculate key to key record by array of keys.\
18
- * ⚠ Unsafe, internal
19
- * @template TArr Array of keys
20
- * @returns Key to key record that includes all array items
21
- * @example
22
- * type n = CheckType<_ToKey2Key<never>, never>;
23
- * type u = CheckType<_ToKey2Key<undefined>, {
24
- * [x: string]: Key;
25
- * [x: number]: Key;
26
- * [x: symbol]: Key;
27
- * }>; // ⚠
28
- *
29
- * type k0 = CheckType<_ToKey2Key<[]>, {}>; // ⚠
30
- * type k1 = CheckType<_ToKey2Key<['a']>, { a: 'a' }>;
31
- * type k2 = CheckType<_ToKey2Key<['a', 1]>, { a: 'a', 1: 1 }>;
32
- * type rk2 = CheckType<_ToKey2Key<readonly ['a', 1]>, { a: 'a', 1: 1 }>;
33
- */
34
- export type _ToKey2Key<TArr extends readonly Key[], R = unknown> = TArr extends readonly [infer F extends Key, ...infer Rest extends Key[]] ? _ToKey2Key<Rest, R & {
35
- [K in F]: F;
36
- }> : {
37
- [K in keyof R]: R[K];
38
- };
39
- /**
40
- * @summary Calculate key to key record by array of keys.
41
- * @template TArr Array of keys
42
- * @returns Key to key record that includes all array items
43
- * @example
44
- * type n = CheckType<ToKey2Key<never>, never>;
45
- * type u = CheckType<ToKey2Key<undefined>, undefined>;
46
- *
47
- * type k0 = CheckType<ToKey2Key<[]>, {}>;
48
- * type k1 = CheckType<ToKey2Key<['a']>, { a: 'a' }>;
49
- * type k2 = CheckType<ToKey2Key<['a', 1]>, { a: 'a', 1: 1 }>;
50
- * type rk2 = CheckType<ToKey2Key<readonly ['a', 1]>, { a: 'a', 1: 1 }>;
51
- */
52
- export type ToKey2Key<TArr extends readonly Key[]> = TArr extends undefined ? TArr : _ToKey2Key<TArr>;
53
- /**
54
- * @summary Calculate record of `T` with key by array of keys.
55
- * @template TArr Array of keys
56
- * @template T Value type
57
- * @example
58
- * type n = CheckType<ToRecord<never, never>, {}>;
59
- * type nu1 = CheckType<ToRecord<undefined, never>, {}>;
60
- * type nu2 = CheckType<ToRecord<never, undefined>, {}>;
61
- * type u = CheckType<ToRecord<undefined, undefined>, {}>;
62
- *
63
- * type k0 = CheckType<ToRecord<[], string>, {}>;
64
- * type k1 = CheckType<ToRecord<['a'], string>, { a: string }>;
65
- * type k2 = CheckType<ToRecord<['a', 1], boolean>, { a: boolean, 1: boolean }>;
66
- * type rk2 = CheckType<ToRecord<readonly ['a', 1], () => 0>, { a: () => 0, 1: () => 0 }>;
67
- */
68
- export type ToRecord<TArr extends readonly Key[], T> = Record<TArr[number], T>;
69
- type _MapFrom<Keys extends readonly Key[], Value extends number, KeyToKey extends boolean, R = unknown> = Keys extends readonly [infer F extends Key, ...infer Rest extends Key[]] ? _MapFrom<Rest, Value extends undefined ? Value : Increment<Value>, KeyToKey, R & (KeyToKey extends true ? {
70
- [K in F]: Value;
71
- } : {
72
- [K in Value]: F;
73
- })> : {
74
- [K in keyof R]: R[K];
75
- };
76
- /**
77
- * @summary Create key-value map by list of keys and first value
78
- * @template Keys Array of keys
79
- * @template FirstValue Value for first item
80
- * @returns Key-value map structural object
81
- * @example
82
- * type n = CheckType<KeyValueMapFrom<never>, never>;
83
- * type u = CheckType<KeyValueMapFrom<undefined>, never>;
84
- *
85
- * type k0 = CheckType<KeyValueMapFrom<[]>, object>;
86
- * type k1 = CheckType<KeyValueMapFrom<['a']>, { a: 0; }>;
87
- * type k2 = CheckType<KeyValueMapFrom<['a', 1]>, { a: 0; 1: 1; }>;
88
- * type k3 = CheckType<KeyValueMapFrom<['a', undefined, 1]>, { a: 0; 1: 2; }>;
89
- * type k4 = CheckType<KeyValueMapFrom<['a', never, 1]>, { a: 0; 1: 2; }>;
90
- *
91
- * type kn = CheckType<KeyValueMapFrom<['a', 1], never>, { a: never; 1: never; }>;
92
- * type ku = CheckType<KeyValueMapFrom<['a', 1], undefined>, { a: undefined; 1: undefined; }>;
93
- * type rku = CheckType<
94
- * KeyValueMapFrom<readonly ['a', 1], undefined>,
95
- * { a: undefined; 1: undefined; }
96
- * >;
97
- */
98
- export type KeyValueMapFrom<Keys extends readonly Key[], FirstValue extends number = 0> = Keys extends undefined ? never : Keys extends ArrN ? _MapFrom<Keys, FirstValue, true> : never;
99
- /**
100
- * @summary Create value-key map by list of keys and first value
101
- * @template Keys Array of keys
102
- * @template FirstValue Value for first item. If is `undefined` or `never` — returns `never`
103
- * @returns Value-key map structural object
104
- * @see KeyValueMapFrom
105
- * @example
106
- * type n = CheckType<ValueKeyMapFrom<never>, never>;
107
- * type u = CheckType<ValueKeyMapFrom<undefined>, never>;
108
- *
109
- * type k0 = CheckType<ValueKeyMapFrom<[]>, object>;
110
- * type k1 = CheckType<ValueKeyMapFrom<['a']>, { 0: 'a'; }>;
111
- * type k2 = CheckType<ValueKeyMapFrom<['a', 1]>, { 0: 'a'; 1: 1; }>;
112
- * type k3 = CheckType<ValueKeyMapFrom<['a', undefined, 1]>, { 0: 'a'; 1: undefined; 2: 1 }>;
113
- * type k4 = CheckType<ValueKeyMapFrom<['a', never, 1]>, { 0: 'a'; 1: never; 2: 1 }>;
114
- *
115
- * type kn = CheckType<ValueKeyMapFrom<['a', 1], never>, never>;
116
- * type ku = CheckType<ValueKeyMapFrom<['a', 1], undefined>, never>;
117
- * type rku = CheckType<ValueKeyMapFrom<readonly ['a', 1], undefined>, never>;
118
- */
119
- export type ValueKeyMapFrom<Keys extends readonly Key[], FirstValue extends number = 0> = Keys extends undefined ? never : FirstValue extends undefined ? never : Keys extends ArrN ? _MapFrom<Keys, FirstValue, false> : never;
120
- export {};
121
- }
@@ -1,244 +0,0 @@
1
- declare namespace AVStantso.TS.Array {
2
- type _ExtremumIndex<TArr extends readonly string[] | readonly number[], IsMin extends boolean, TRest extends readonly string[] | readonly number[] = TArr, R extends number = undefined, I extends number = 0> = TRest extends readonly [
3
- infer F extends string | number,
4
- ...infer Rest extends string[] | number[]
5
- ] ? _ExtremumIndex<TArr, IsMin, Rest, R extends undefined ? 0 : F extends undefined ? R : _LT_GT<[F, TArr[R], I, R], IsMin>, Increment<I>> : R;
6
- type _Extremum<TArr extends readonly string[] | readonly number[], IsMin extends boolean, ReturnIdx extends boolean, R extends number = _ExtremumIndex<TArr, IsMin>> = ReturnIdx extends true ? R : TArr[R];
7
- type Extremum<TArr extends readonly string[] | readonly number[], IsMin extends boolean, ReturnIdx extends boolean> = TArr extends [] ? undefined : TArr extends ArrN ? _Extremum<TArr, IsMin, ReturnIdx> : never;
8
- /**
9
- * @summary Find array minimal item.
10
- * @template TArr Array to find
11
- * @returns Minimal item. `undefined` for empty array
12
- * @example
13
- * type n = CheckType<Min<never>, never>;
14
- * type u = CheckType<Min<undefined>, never>;
15
- *
16
- * type z = CheckType<Min<[]>, undefined>;
17
- *
18
- * type n0 = CheckType<Min<[1]>, 1>;
19
- * type n1 = CheckType<Min<[2, 1]>, 1>;
20
- * type n2 = CheckType<Min<[2, undefined, 1]>, 1>;
21
- *
22
- * type s0 = CheckType<Min<['a']>, 'a'>;
23
- * type s1 = CheckType<Min<['b', 'a']>, 'a'>;
24
- * type s2 = CheckType<Min<['b', undefined, 'a']>, 'a'>;
25
- * type rs2 = CheckType<Min<readonly ['b', undefined, 'a']>, 'a'>;
26
- */
27
- export type Min<TArr extends readonly string[] | readonly number[]> = TArr extends undefined ? never : Extremum<TArr, true, false>;
28
- export namespace Min {
29
- /**
30
- * @summary Find array minimal item index.
31
- * @template TArr Array to find
32
- * @returns Minimal item index. `undefined` for empty array
33
- * @example
34
- * type n = CheckType<Min.Index<never>, never>;
35
- * type u = CheckType<Min.Index<undefined>, never>;
36
- *
37
- * type z = CheckType<Min.Index<[]>, undefined>;
38
- *
39
- * type n0 = CheckType<Min.Index<[1]>, 0>;
40
- * type n1 = CheckType<Min.Index<[2, 1]>, 1>;
41
- * type n2 = CheckType<Min.Index<[1, 2]>, 0>;
42
- * type n3 = CheckType<Min<[2, undefined, 1]>, 1>;
43
- *
44
- * type s0 = CheckType<Min.Index<['a']>, 0>;
45
- * type s1 = CheckType<Min.Index<['b', 'a']>, 1>;
46
- * type s2 = CheckType<Min.Index<['b', undefined, 'a']>, 2>;
47
- * type rs2 = CheckType<Min.Index<readonly ['b', undefined, 'a']>, 2>;
48
- */
49
- type Index<TArr extends readonly string[] | readonly number[]> = TArr extends undefined ? never : Extremum<TArr, true, true>;
50
- }
51
- /**
52
- * @summary Find array maximal item.
53
- * @template TArr Array to find
54
- * @returns Maximal item. `undefined` for empty array
55
- * @example
56
- * type n = CheckType<Max<never>, never>;
57
- * type u = CheckType<Max<undefined>, never>;
58
- *
59
- * type z = CheckType<Max<[]>, undefined>;
60
- *
61
- * type n0 = CheckType<Max<[1]>, 1>;
62
- * type n1 = CheckType<Max<[2, 1]>, 2>;
63
- * type n2 = CheckType<Max<[2, undefined, 1]>, 2>;
64
- *
65
- * type s0 = CheckType<Max<['a']>, 'a'>;
66
- * type s1 = CheckType<Max<['b', 'a']>, 'b'>;
67
- * type s2 = CheckType<Max<['b', undefined, 'a']>, 'b'>;
68
- * type rs2 = CheckType<Max<readonly ['b', undefined, 'a']>, 'b'>;
69
- */
70
- export type Max<TArr extends readonly string[] | readonly number[]> = TArr extends undefined ? never : Extremum<TArr, false, false>;
71
- export namespace Max {
72
- /**
73
- * @summary Find array maximal item index.
74
- * @template TArr Array to find
75
- * @returns Maximal item index. `undefined` for empty array
76
- * @example
77
- * type n = CheckType<Max.Index<never>, never>;
78
- * type u = CheckType<Max.Index<undefined>, never>;
79
- *
80
- * type z = CheckType<Max.Index<[]>, undefined>;
81
- *
82
- * type n0 = CheckType<Max.Index<[1]>, 0>;
83
- * type n1 = CheckType<Max.Index<[2, 1]>, 0>;
84
- * type n2 = CheckType<Max.Index<[1, 2]>, 1>;
85
- * type n3 = CheckType<Max.Index<[1, undefined, 2]>, 2>;
86
- *
87
- * type s0 = CheckType<Max.Index<['a']>, 0>;
88
- * type s1 = CheckType<Max.Index<['b', 'a']>, 0>;
89
- * type s2 = CheckType<Max.Index<['b', undefined, 'a']>, 0>;
90
- * type rs2 = CheckType<Max.Index<readonly ['b', undefined, 'a']>, 0>;
91
- */
92
- type Index<TArr extends readonly string[] | readonly number[]> = TArr extends undefined ? never : Extremum<TArr, false, true>;
93
- }
94
- type _Sort<TArr extends ArrR, Asc extends boolean, L extends number, I extends number = 0, R extends Arr = []> = I extends L ? [...R, ...TArr] : TArr extends readonly [infer F, infer S, ...infer Rest] ? _LT_GT<[F, S, [F, S], [S, F]], Asc> extends readonly [infer _F, infer _S] ? _Sort<[_S, ...Rest], Asc, L, I, [...R, _F]> : never : _Sort<[...R, ...TArr], Asc, L, Increment<I>>;
95
- type _SortPairs<TArr extends readonly Sort.Pair[], Asc extends boolean, L extends number, I extends number = 0, R extends readonly Sort.Pair[] = []> = I extends L ? [...R, ...TArr] : TArr extends readonly [
96
- infer F extends Sort.Pair,
97
- infer S extends Sort.Pair,
98
- ...infer Rest extends Sort.Pair[]
99
- ] ? _LT_GT<[F[0], S[0], [F, S], [S, F]], Asc, Asc> extends readonly [
100
- infer _F extends Sort.Pair,
101
- infer _S extends Sort.Pair
102
- ] ? _SortPairs<[_S, ...Rest], Asc, L, I, [...R, _F]> : never : _SortPairs<[...R, ...TArr], Asc, L, Increment<I>>;
103
- type _SortCheck<TArr extends readonly string[] | readonly number[] | readonly Sort.Pair<string>[] | readonly Sort.Pair<number>[], Asc extends boolean, L extends number = Length<TArr>> = L extends 0 | 1 ? TArr : TArr extends readonly string[] | readonly number[] ? _Sort<TArr, Asc, Increment<L>> : TArr extends readonly Sort.Pair<string>[] | readonly Sort.Pair<number>[] ? Asc extends true ? _SortPairs<TArr, Asc, Increment<L>> : _SortPairs<_Reverse<TArr>, Asc, Increment<L>> : never;
104
- /**
105
- * @summary Sort array items.
106
- * @template TArr Array to sort
107
- * @template Asc Is ascending sort order
108
- * @example
109
- * type dn = [1, 4, 5, 3, 2, 78, 1];
110
- * type ds = ['abc', 'eb', '', '1', 'ab', ' '];
111
- * type dpn = [
112
- * [1, symbol],
113
- * [4, () => null],
114
- * [5, []],
115
- * [3, { n: number }],
116
- * [2, Buffer],
117
- * [78, 45],
118
- * [1, never]
119
- * ];
120
- * type dps = [
121
- * ['abc', symbol],
122
- * ['eb', () => null],
123
- * [ '', []],
124
- * ['1', { n: number }],
125
- * ['ab', Buffer],
126
- * [' ', 45]
127
- * ];
128
- * @example
129
- * type n = CheckType<Sort<never>, never>;
130
- * type u = CheckType<Sort<undefined>, never>;
131
- *
132
- * type n_asc = CheckType<Sort<dn>, [1, 1, 2, 3, 4, 5, 78]>;
133
- * type n_desc = CheckType<Sort<dn, false>, [78, 5, 4, 3, 2, 1, 1]>;
134
- *
135
- * type s_asc = CheckType<Sort<ds>, ['', ' ', '1', 'ab', 'abc', 'eb']>;
136
- * type s_desc = CheckType<Sort<ds, false>, ['eb', 'abc', 'ab', '1', ' ', '']>;
137
- *
138
- * type rs_asc = CheckType<Sort<readonly [...ds]>, ['', ' ', '1', 'ab', 'abc', 'eb']>;
139
- * type rs_desc = CheckType<Sort<readonly [...ds], false>, ['eb', 'abc', 'ab', '1', ' ', '']>;
140
- *
141
- * type n_pasc = CheckType<
142
- * Sort<dpn>, [
143
- * [1, symbol],
144
- * [1, never],
145
- * [2, Buffer],
146
- * [3, { n: number; }],
147
- * [4, () => null],
148
- * [5, []],
149
- * [78, 45]
150
- * ]>;
151
- * type n_pdesc = CheckType<
152
- * Sort<dpn, false>, [
153
- * [78, 45],
154
- * [5, []],
155
- * [4, () => null],
156
- * [3, { n: number; }],
157
- * [2, Buffer],
158
- * [1, never],
159
- * [1, symbol]
160
- * ]>;
161
- *
162
- * type s_pasc = CheckType<
163
- * Sort<dps>, [
164
- * ['', []],
165
- * [' ', 45],
166
- * ['1', { n: number; }],
167
- * ['ab', Buffer],
168
- * ['abc', symbol],
169
- * ['eb', () => null]
170
- * ]>;
171
- *
172
- * type s_pdesc = CheckType<
173
- * Sort<dps, false>, [
174
- * ['eb', () => null],
175
- * ['abc', symbol],
176
- * ['ab', Buffer],
177
- * ['1', { n: number; }],
178
- * [' ', 45],
179
- * ['', []]
180
- * ]>;
181
- */
182
- export type Sort<TArr extends readonly string[] | readonly number[] | readonly Sort.Pair<string>[] | readonly Sort.Pair<number>[], Asc extends boolean = true> = TArr extends undefined ? never : TArr extends ArrN ? _SortCheck<TArr, Asc> : never;
183
- export namespace Sort {
184
- /**
185
- * @summary Pair key-data for sort any data by key
186
- */
187
- type Pair<K extends number | string = number | string> = [K, any];
188
- /**
189
- * @summary Sort array items descending.
190
- * @template TArr Array to sort
191
- * @example
192
- * type dn = [1, 4, 5, 3, 2, 78, 1];
193
- * type ds = ['abc', 'eb', '', '1', 'ab', ' '];
194
- * type dpn = [
195
- * [1, symbol],
196
- * [4, () => null],
197
- * [5, []],
198
- * [3, { n: number }],
199
- * [2, Buffer],
200
- * [78, 45],
201
- * [1, never]
202
- * ];
203
- * type dps = [
204
- * ['abc', symbol],
205
- * ['eb', () => null],
206
- * [ '', []],
207
- * ['1', { n: number }],
208
- * ['ab', Buffer],
209
- * [' ', 45]
210
- * ];
211
- * @example
212
- * type n = CheckType<Sort.Desc<never>, never>;
213
- * type u = CheckType<Sort.Desc<undefined>, never>;
214
- *
215
- * type n_desc = CheckType<Sort.Desc<dn>, [78, 5, 4, 3, 2, 1, 1]>;
216
- *
217
- * type s_desc = CheckType<Sort.Desc<ds>, ['eb', 'abc', 'ab', '1', ' ', '']>;
218
- * type rs_desc = CheckType<Sort.Desc<readonly [...ds]>, ['eb', 'abc', 'ab', '1', ' ', '']>;
219
- *
220
- * type n_pdesc = CheckType<
221
- * Sort.Desc<dpn>, [
222
- * [78, 45],
223
- * [5, []],
224
- * [4, () => null],
225
- * [3, { n: number; }],
226
- * [2, Buffer],
227
- * [1, never],
228
- * [1, symbol]
229
- * ]>;
230
- *
231
- * type s_pdesc = CheckType<
232
- * Sort.Desc<dps>, [
233
- * ['eb', () => null],
234
- * ['abc', symbol],
235
- * ['ab', Buffer],
236
- * ['1', { n: number; }],
237
- * [' ', 45],
238
- * ['', []]
239
- * ]>;
240
- */
241
- type Desc<TArr extends readonly string[] | readonly number[] | readonly Sort.Pair<string>[] | readonly Sort.Pair<number>[]> = _SortCheck<TArr, false>;
242
- }
243
- export {};
244
- }
@@ -1,76 +0,0 @@
1
- declare namespace AVStantso {
2
- const ASCII_Control_Characters: readonly ["␀", "␁", "␂", "␃", "␄", "␅", "␆", "␇", "␈", "␉", "␊", "␋", "␌", "␍", "␎", "␏", "␐", "␑", "␒", "␓", "␔", "␕", "␖", "␗", "␘", "␙", "␚", "␛", "␜", "␝", "␞", "␟"];
3
- const ASCII_Printable_Characters_Letters_Upper: readonly ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
4
- const ASCII_Printable_Characters_Letters_Lower: readonly ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
5
- const ASCII_Printable_Characters: readonly [" ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "␡"];
6
- const ASCII_Extended_Codes: readonly ["€", "Unused0", "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", "Unused1", "Ž", "Unused2", "Unused3", "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", "Unused4", "ž", "Ÿ", "NBSP", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "SHY", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"];
7
- export namespace TS {
8
- /**
9
- * @summary English letters
10
- */
11
- namespace Letters {
12
- type Upper = typeof ASCII_Printable_Characters_Letters_Upper;
13
- type Lower = typeof ASCII_Printable_Characters_Letters_Lower;
14
- }
15
- type Letters<IsUpper extends boolean = true> = IsUpper extends true ? Letters.Upper : Letters.Lower;
16
- /**
17
- * @summary `ASCII` characters
18
- * @see https://www.ascii-code.com/
19
- */
20
- type ASCII = readonly [
21
- ...ASCII.Control,
22
- ...ASCII.Printable,
23
- ...ASCII.Extended
24
- ];
25
- namespace ASCII {
26
- /**
27
- * @summary ASCII control characters (character code `0-31`)
28
- */
29
- type Control = typeof ASCII_Control_Characters;
30
- /**
31
- * @summary ASCII printable characters (character code `32-127`)
32
- */
33
- type Printable = typeof ASCII_Printable_Characters;
34
- /**
35
- * @summary The extended ASCII codes (character code `128-255`)
36
- */
37
- type Extended = typeof ASCII_Extended_Codes;
38
- /**
39
- * @summary ASCII characters map char-code
40
- */
41
- namespace Map {
42
- /**
43
- * @summary ASCII control characters (character code `0-31`)
44
- */
45
- type Control = Array.KeyValueMapFrom<ASCII.Control>;
46
- /**
47
- * @summary ASCII printable characters (character code `32-127`)
48
- */
49
- type Printable = Array.KeyValueMapFrom<ASCII.Printable, 32>;
50
- /**
51
- * @summary The extended ASCII codes (character code `128-255`)
52
- */
53
- type Extended = Array.KeyValueMapFrom<ASCII.Extended, 128>;
54
- }
55
- type Map = Array.KeyValueMapFrom<ASCII>;
56
- type _Code<S extends string, R extends number = Extract<ASCII.Map[Extract<S, keyof ASCII.Map>], number>> = R;
57
- /**
58
- * @summary Gets `ASCII` characters code by `S`. `never` if `S` is not a character.
59
- */
60
- type Code<S extends string> = _Code<S>;
61
- /**
62
- * @summary ASCII character union
63
- */
64
- type Character = Array.ToKey<ASCII>;
65
- }
66
- }
67
- export namespace Code {
68
- interface TS {
69
- /**
70
- * @summary `ASCII` characters array
71
- */
72
- ASCII: AVStantso.TS.ASCII;
73
- }
74
- }
75
- export {};
76
- }
@@ -1,74 +0,0 @@
1
- declare namespace AVStantso.TS {
2
- /**
3
- * @summary If `Condition` is `true` returns `IfTrue` else `IfFalse`
4
- * @template Condition Condition
5
- * @template IfTrue Result, if `Condition` is `true`
6
- * @template IfFalse Result, if `Condition` is NOT `true`
7
- * @returns `IfFalse` or `IfTrue` param
8
- * @example
9
- * type nv = CheckType<If<never>, never>;
10
- * type u = CheckType<If<undefined>, false>;
11
- * type nl = CheckType<If<null>, false>;
12
- * type f = CheckType<If<false>, false>;
13
- * type t = CheckType<If<true>, true>;
14
- * type a = CheckType<If<any>, boolean>;
15
- */
16
- type If<Condition extends boolean, IfTrue = true, IfFalse = false> = Condition extends undefined ? IfFalse : Condition extends true ? IfTrue : IfFalse;
17
- namespace If {
18
- }
19
- /**
20
- * @summary If all `Conditions` in array is `true` returns `IfTrue` else `IfFalse`
21
- * @template Conditions Conditions array
22
- * @template IfTrue Result, if all `Conditions` is `true`
23
- * @template IfFalse Result, if any item of `Conditions` is NOT `true`
24
- * @returns `IfFalse` or `IfTrue` param
25
- * @example
26
- * type n = CheckType<And<never>, never>;
27
- * type u = CheckType<And<undefined>, never>;
28
- * type u2 = CheckType<And<[true, undefined, true]>, false>;
29
- * type f = CheckType<And<[true, true, false]>, false>;
30
- * type t = CheckType<And<[true, true, true]>, true>;
31
- * type tr = CheckType<And<readonly [true, true, true]>, true>;
32
- */
33
- type And<Conditions extends readonly boolean[], IfTrue = true, IfFalse = false> = Array.IfEach<Conditions, true, IfTrue, IfFalse>;
34
- namespace And {
35
- }
36
- /**
37
- * @summary If one or more `Conditions` in array is `true` returns `IfTrue` else `IfFalse`
38
- * @template Conditions Conditions array
39
- * @template IfTrue Result, if any item of `Conditions` is `true`
40
- * @template IfFalse Result, if all `Conditions` is NOT `true`
41
- * @returns `IfFalse` or `IfTrue` param
42
- * @example
43
- * type n = CheckType<Or<never>, never>;
44
- * type u = CheckType<Or<undefined>, never>;
45
- * type u2 = CheckType<Or<[false, undefined, true]>, true>;
46
- * type f = CheckType<Or<[false, false, false]>, false>;
47
- * type t = CheckType<Or<[true, true, false]>, true>;
48
- * type tr = CheckType<Or<readonly [true, true, false]>, true>;
49
- */
50
- type Or<Conditions extends readonly boolean[], IfTrue = true, IfFalse = false> = Array.IfHasItem<Conditions, true, IfTrue, IfFalse>;
51
- namespace Or {
52
- }
53
- /**
54
- * @summary If only one item of `Conditions` in array is `true` returns `IfTrue` else `IfFalse`
55
- * @template Conditions Conditions array
56
- * @template IfTrue Result, if only one item of `Conditions` is `true`
57
- * @template IfFalse Result, if each item of `Conditions` is NOT `true` or more one item of `Conditions` is `true`
58
- * @returns `IfFalse` or `IfTrue` param
59
- * @example
60
- * type n = CheckType<Xor<never>, never>;
61
- * type u = CheckType<Xor<undefined>, never>;
62
- * type u2 = CheckType<Xor<[false, undefined, true]>, true>;
63
- * type fff = CheckType<Xor<[false, false, false]>, false>;
64
- * type ttf = CheckType<Xor<[true, true, false]>, false>;
65
- * type tff = CheckType<Xor<[true, false, false]>, true>;
66
- * type ftf = CheckType<Xor<[false, true, false]>, true>;
67
- * type fft = CheckType<Xor<[false, false, true]>, true>;
68
- * type ttt = CheckType<Xor<[true, true, false]>, false>;
69
- * type tr = CheckType<Xor<readonly [true, true, false]>, false>;
70
- */
71
- type Xor<Conditions extends readonly boolean[], IfTrue = true, IfFalse = false> = Conditions extends undefined ? never : Array.CountOf<Conditions, true> extends 1 ? IfTrue : IfFalse;
72
- namespace Xor {
73
- }
74
- }
@@ -1,85 +0,0 @@
1
- declare namespace AVStantso.TS {
2
- type Args<Item1 = unknown, Item2 = Item1, IfTrue = unknown, IfFalse = unknown> = [Item1, Item2, IfTrue, IfFalse];
3
- namespace Number {
4
- type _LT_For<Ag extends Args<number>, I extends number = 0> = I extends Ag[0] ? Ag[2] : I extends Ag[1] ? Ag[3] : _LT_For<Ag, Increment<I>>;
5
- type _LT_Digit<Ag extends Args<Arr>> = Ag[0] extends [`${infer AF extends number}`, ...infer ARest] ? Ag[1] extends [`${infer BF extends number}`, ...infer BRest] ? AF extends BF ? _LT_Digit<[ARest, BRest, Ag[2], Ag[3]]> : _LT_For<[AF, BF, Ag[2], Ag[3]]> : never : never;
6
- type _LT_Length<Ag extends Args<number>, LA extends number = TS.String._Length<`${Ag[0]}`>, LB extends number = TS.String._Length<`${Ag[1]}`>> = LA extends LB ? _LT_Digit<[
7
- TS.String._SplitToChars<`${Ag[0]}`>,
8
- TS.String._SplitToChars<`${Ag[1]}`>,
9
- Ag[2],
10
- Ag[3]
11
- ]> : _LT_For<[LA, LB, Ag[2], Ag[3]]>;
12
- type _LT_Sign<Ag extends Args<number>> = `${Ag[0]}` extends `-${infer A extends number}` ? `${Ag[1]}` extends `-${infer B extends number}` ? _LT_Length<[B, A, Ag[2], Ag[3]]> : Ag[2] : `${Ag[1]}` extends `-${number}` ? Ag[3] : _LT_Length<Ag>;
13
- }
14
- namespace String {
15
- type _LT<Ag extends Args<string>> = Ag[0] extends `${infer AC}${infer AE}` ? Ag[1] extends `${infer BC}${infer BE}` ? AC extends BC ? _LT<[AE, BE, Ag[2], Ag[3]]> : Number._LT_Length<[ASCII.Code<AC>, ASCII.Code<BC>, Ag[2], Ag[3]]> : Ag[3] : Ag[2];
16
- }
17
- /**
18
- * @summary Low-level test `Eq===true ? A <= B : A < B`
19
- * @template Ag Arguments `[A, B, IfTrue, IfFalse]`
20
- * @template Eq `true` — `<=`, `false` — `<`
21
- * @returns `Ag[2] | Ag[3]`
22
- * @example
23
- * type nt = CheckType<_LT<[1, 2, true, false]>, true>;
24
- * type st = CheckType<_LT<['a', 'b', true, false]>, true>;
25
- * type nf = CheckType<_LT<[2, 1, true, false]>, false>;
26
- * type sf = CheckType<_LT<['c', 'b', true, false]>, false>;
27
- *
28
- * type n_large_p = CheckType<_LT<[9999998, 9999999, true, false]>, true>;
29
- * type n_large_n = CheckType<_LT<[-9999999, -9999998, true, false]>, true>;
30
- */
31
- export type _LT<Ag extends Args, Eq extends boolean = false> = Ag[0] extends Ag[1] ? Eq extends true ? Ag[2] : Ag[3] : Ag extends [number, number, unknown, unknown] ? Number._LT_Sign<Ag> : Ag extends [string, string, unknown, unknown] ? String._LT<Ag> : never;
32
- /**
33
- * @summary Low-level test `Eq===true ? IsLT===true ? A <= B : A => B : IsLT ? A < B : A > B`
34
- * @template Ag Arguments `[A, B, IfTrue, IfFalse]`
35
- * @template IsLT `true` — `<`, `false` — `>`
36
- * @template Eq `true` — `<=`, `false` — `<`
37
- * @returns `Ag[2] | Ag[3]`
38
- * @example
39
- * type nt = CheckType<_LT_GT<[1, 2, true, false], true>, true>;
40
- * type st = CheckType<_LT_GT<['a', 'b', true, false], true>, true>;
41
- * type nf = CheckType<_LT_GT<[2, 1, true, false], true>, false>;
42
- * type sf = CheckType<_LT_GT<['c', 'b', true, false], true>, false>;
43
- *
44
- * type n_large_p = CheckType<_LT_GT<[9999998, 9999999, true, false], true>, true>;
45
- * type n_large_n = CheckType<_LT_GT<[-9999999, -9999998, true, false], true>, true>;
46
- */
47
- export type _LT_GT<Ag extends Args, IsLT extends boolean, Eq extends boolean = false> = _LT<IsLT extends true ? Ag : [Ag[1], Ag[0], Ag[2], Ag[3]], Eq>;
48
- /**
49
- * @summary Test `A < B`
50
- * @template A argument for comparision
51
- * @template B argument for comparision
52
- * @template IfTrue Result, if `A < B`
53
- * @template IfFalse Result, if `A >= B`
54
- * @returns `IfFalse` or `IfTrue` param
55
- */
56
- export type LT<A extends number | string, B extends number | string, IfTrue = true, IfFalse = false> = _LT<[A, B, IfTrue, IfFalse]>;
57
- /**
58
- * @summary Test `A <= B`
59
- * @template A argument for comparision
60
- * @template B argument for comparision
61
- * @template IfTrue Result, if `A <= B`
62
- * @template IfFalse Result, if `A > B`
63
- * @returns `IfFalse` or `IfTrue` param
64
- */
65
- export type LTE<A extends number | string, B extends number | string, IfTrue = true, IfFalse = false> = _LT<[A, B, IfTrue, IfFalse], true>;
66
- /**
67
- * @summary Test `A > B`
68
- * @template A argument for comparision
69
- * @template B argument for comparision
70
- * @template IfTrue Result, if `A > B`
71
- * @template IfFalse Result, if `A <= B`
72
- * @returns `IfFalse` or `IfTrue` param
73
- */
74
- export type GT<A extends number | string, B extends number | string, IfTrue = true, IfFalse = false> = _LT<[B, A, IfTrue, IfFalse]>;
75
- /**
76
- * @summary Test `A >= B`
77
- * @template A argument for comparision
78
- * @template B argument for comparision
79
- * @template IfTrue Result, if `A >= B`
80
- * @template IfFalse Result, if `A < B`
81
- * @returns `IfFalse` or `IfTrue` param
82
- */
83
- export type GTE<A extends number | string, B extends number | string, IfTrue = true, IfFalse = false> = _LT<[B, A, IfTrue, IfFalse], true>;
84
- export {};
85
- }
@@ -1,17 +0,0 @@
1
- declare namespace AVStantso.TS.Func {
2
- /**
3
- * @summary Nested function type
4
- * @template Depth nesting depth
5
- * @example
6
- * type n = CheckType<Nested<never>, never>;
7
- * type u = CheckType<Nested<undefined>, (...params: Arr) => unknown>;
8
- *
9
- * type r0 = CheckType<Nested<0>, (...params: Arr) => unknown>;
10
- * type r1 = CheckType<Nested<1>, (...params: Arr) => (...params: Arr) => unknown>;
11
- * type r2 = CheckType<
12
- * Nested<2>,
13
- * (...params: Arr) => (...params: Arr) => (...params: Arr) => unknown
14
- * >;
15
- */
16
- type Nested<Depth extends number = 1, R = unknown, P extends Arr = Arr> = Depth extends 0 ? Func<R, P> : Func<Nested<Decrement<Depth>, R, P>>;
17
- }
@@ -1,14 +0,0 @@
1
- import './_register';
2
- import './func';
3
- import './union';
4
- import './array';
5
- import './ascii';
6
- import './boolean';
7
- import './comparisons';
8
- import './numeric';
9
- import './string';
10
- import './literal';
11
- import './structure';
12
- import './resolve';
13
- import './type';
14
- import './utility';