type-plus 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -156
- package/cjs/any/any_type.d.ts +8 -8
- package/cjs/any/any_type.d.ts.map +1 -1
- package/cjs/array/array.at.d.ts +3 -1
- package/cjs/array/array.at.d.ts.map +1 -1
- package/cjs/array/array.find.d.ts +3 -1
- package/cjs/array/array.find.d.ts.map +1 -1
- package/cjs/array/array.find_last.d.ts +3 -1
- package/cjs/array/array.find_last.d.ts.map +1 -1
- package/cjs/array/array.some.d.ts +1 -1
- package/cjs/array/array.some.d.ts.map +1 -1
- package/cjs/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
- package/cjs/array/array_plus.concat.d.ts.map +1 -0
- package/cjs/array/{array.concat.js → array_plus.concat.js} +1 -1
- package/cjs/array/array_plus.concat.js.map +1 -0
- package/cjs/array/array_plus.d.ts +3 -2
- package/cjs/array/array_plus.d.ts.map +1 -1
- package/cjs/array/array_plus.filter.d.ts +2 -0
- package/cjs/array/array_plus.filter.d.ts.map +1 -0
- package/cjs/array/array_plus.filter.js +3 -0
- package/cjs/array/array_plus.filter.js.map +1 -0
- package/cjs/array/array_plus.pad_start.d.ts +5 -0
- package/cjs/array/array_plus.pad_start.d.ts.map +1 -0
- package/cjs/array/array_plus.pad_start.js +3 -0
- package/cjs/array/array_plus.pad_start.js.map +1 -0
- package/cjs/array/array_type.d.ts +30 -12
- package/cjs/array/array_type.d.ts.map +1 -1
- package/cjs/array/filter.d.ts +24 -4
- package/cjs/array/filter.d.ts.map +1 -1
- package/cjs/array/head.d.ts +18 -1
- package/cjs/array/head.d.ts.map +1 -1
- package/cjs/array/intersect_of_props.d.ts +5 -3
- package/cjs/array/intersect_of_props.d.ts.map +1 -1
- package/cjs/array/last.d.ts +16 -2
- package/cjs/array/last.d.ts.map +1 -1
- package/cjs/array/literal_array.d.ts +5 -0
- package/cjs/array/literal_array.d.ts.map +1 -1
- package/cjs/array/literal_array.js +5 -0
- package/cjs/array/literal_array.js.map +1 -1
- package/cjs/array/pad_start.d.ts +5 -5
- package/cjs/array/pad_start.d.ts.map +1 -1
- package/cjs/array/reduce_while.d.ts +6 -0
- package/cjs/array/reduce_while.d.ts.map +1 -1
- package/cjs/array/reduce_while.js +6 -0
- package/cjs/array/reduce_while.js.map +1 -1
- package/cjs/array/reverse.d.ts +5 -0
- package/cjs/array/reverse.d.ts.map +1 -1
- package/cjs/array/union_of_props.d.ts +1 -1
- package/cjs/array/union_of_props.d.ts.map +1 -1
- package/cjs/functional/compose.d.ts +2 -1
- package/cjs/functional/compose.d.ts.map +1 -1
- package/cjs/functional/compose.js.map +1 -1
- package/cjs/functional/context.d.ts.map +1 -1
- package/cjs/index.d.ts +19 -3
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +9 -3
- package/cjs/index.js.map +1 -1
- package/cjs/math/numeric_struct.d.ts +1 -1
- package/cjs/math/numeric_struct.d.ts.map +1 -1
- package/cjs/mix_types/any_or_never_type.d.ts +18 -10
- package/cjs/mix_types/any_or_never_type.d.ts.map +1 -1
- package/cjs/nodejs/isNodeError.d.ts.map +1 -1
- package/cjs/nominal/brand.d.ts.map +1 -1
- package/cjs/nominal/flavor.d.ts.map +1 -1
- package/cjs/testing/test_type.d.ts +44 -1
- package/cjs/testing/test_type.d.ts.map +1 -1
- package/cjs/tuple/common_prop_keys.d.ts +29 -0
- package/cjs/tuple/common_prop_keys.d.ts.map +1 -0
- package/cjs/tuple/common_prop_keys.js.map +1 -0
- package/cjs/tuple/create_tuple.d.ts.map +1 -1
- package/cjs/tuple/drop.d.ts +72 -0
- package/cjs/tuple/drop.d.ts.map +1 -0
- package/cjs/{array → tuple}/drop.js +3 -1
- package/cjs/tuple/drop.js.map +1 -0
- package/{esm/array → cjs/tuple}/tail.d.ts +1 -1
- package/cjs/{array → tuple}/tail.d.ts.map +1 -1
- package/cjs/{array → tuple}/tail.js.map +1 -1
- package/cjs/tuple/tuple_plus.d.ts +2 -1
- package/cjs/tuple/tuple_plus.d.ts.map +1 -1
- package/cjs/tuple/tuple_plus.filter.d.ts +13 -0
- package/cjs/tuple/tuple_plus.filter.d.ts.map +1 -0
- package/cjs/tuple/tuple_plus.filter.js +3 -0
- package/cjs/tuple/tuple_plus.filter.js.map +1 -0
- package/cjs/tuple/tuple_plus.js +0 -15
- package/cjs/tuple/tuple_plus.js.map +1 -1
- package/cjs/tuple/tuple_plus.pad_start.d.ts +8 -3
- package/cjs/tuple/tuple_plus.pad_start.d.ts.map +1 -1
- package/esm/any/any_type.d.ts +8 -8
- package/esm/any/any_type.d.ts.map +1 -1
- package/esm/array/array.at.d.ts +3 -1
- package/esm/array/array.at.d.ts.map +1 -1
- package/esm/array/array.find.d.ts +3 -1
- package/esm/array/array.find.d.ts.map +1 -1
- package/esm/array/array.find_last.d.ts +3 -1
- package/esm/array/array.find_last.d.ts.map +1 -1
- package/esm/array/array.some.d.ts +1 -1
- package/esm/array/array.some.d.ts.map +1 -1
- package/esm/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
- package/esm/array/array_plus.concat.d.ts.map +1 -0
- package/esm/array/array_plus.concat.js +2 -0
- package/esm/array/array_plus.concat.js.map +1 -0
- package/esm/array/array_plus.d.ts +3 -2
- package/esm/array/array_plus.d.ts.map +1 -1
- package/esm/array/array_plus.filter.d.ts +2 -0
- package/esm/array/array_plus.filter.d.ts.map +1 -0
- package/esm/array/array_plus.filter.js +2 -0
- package/esm/array/array_plus.filter.js.map +1 -0
- package/esm/array/array_plus.pad_start.d.ts +5 -0
- package/esm/array/array_plus.pad_start.d.ts.map +1 -0
- package/esm/array/array_plus.pad_start.js +2 -0
- package/esm/array/array_plus.pad_start.js.map +1 -0
- package/esm/array/array_type.d.ts +30 -12
- package/esm/array/array_type.d.ts.map +1 -1
- package/esm/array/filter.d.ts +24 -4
- package/esm/array/filter.d.ts.map +1 -1
- package/esm/array/head.d.ts +18 -1
- package/esm/array/head.d.ts.map +1 -1
- package/esm/array/intersect_of_props.d.ts +5 -3
- package/esm/array/intersect_of_props.d.ts.map +1 -1
- package/esm/array/last.d.ts +16 -2
- package/esm/array/last.d.ts.map +1 -1
- package/esm/array/literal_array.d.ts +5 -0
- package/esm/array/literal_array.d.ts.map +1 -1
- package/esm/array/literal_array.js +5 -0
- package/esm/array/literal_array.js.map +1 -1
- package/esm/array/pad_start.d.ts +5 -5
- package/esm/array/pad_start.d.ts.map +1 -1
- package/esm/array/reduce_while.d.ts +6 -0
- package/esm/array/reduce_while.d.ts.map +1 -1
- package/esm/array/reduce_while.js +6 -0
- package/esm/array/reduce_while.js.map +1 -1
- package/esm/array/reverse.d.ts +5 -0
- package/esm/array/reverse.d.ts.map +1 -1
- package/esm/array/union_of_props.d.ts +1 -1
- package/esm/array/union_of_props.d.ts.map +1 -1
- package/esm/functional/compose.d.ts +2 -1
- package/esm/functional/compose.d.ts.map +1 -1
- package/esm/functional/compose.js.map +1 -1
- package/esm/functional/context.d.ts.map +1 -1
- package/esm/index.d.ts +19 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -2
- package/esm/index.js.map +1 -1
- package/esm/math/numeric_struct.d.ts +1 -1
- package/esm/math/numeric_struct.d.ts.map +1 -1
- package/esm/mix_types/any_or_never_type.d.ts +18 -10
- package/esm/mix_types/any_or_never_type.d.ts.map +1 -1
- package/esm/nodejs/isNodeError.d.ts.map +1 -1
- package/esm/nominal/brand.d.ts.map +1 -1
- package/esm/nominal/flavor.d.ts.map +1 -1
- package/esm/testing/test_type.d.ts +44 -1
- package/esm/testing/test_type.d.ts.map +1 -1
- package/esm/tuple/common_prop_keys.d.ts +29 -0
- package/esm/tuple/common_prop_keys.d.ts.map +1 -0
- package/esm/tuple/common_prop_keys.js.map +1 -0
- package/esm/tuple/create_tuple.d.ts.map +1 -1
- package/esm/tuple/drop.d.ts +72 -0
- package/esm/tuple/drop.d.ts.map +1 -0
- package/esm/tuple/drop.js +9 -0
- package/esm/tuple/drop.js.map +1 -0
- package/{cjs/array → esm/tuple}/tail.d.ts +1 -1
- package/esm/{array → tuple}/tail.d.ts.map +1 -1
- package/esm/{array → tuple}/tail.js.map +1 -1
- package/esm/tuple/tuple_plus.d.ts +2 -1
- package/esm/tuple/tuple_plus.d.ts.map +1 -1
- package/esm/tuple/tuple_plus.filter.d.ts +13 -0
- package/esm/tuple/tuple_plus.filter.d.ts.map +1 -0
- package/esm/tuple/tuple_plus.filter.js +2 -0
- package/esm/tuple/tuple_plus.filter.js.map +1 -0
- package/esm/tuple/tuple_plus.js +1 -1
- package/esm/tuple/tuple_plus.js.map +1 -1
- package/esm/tuple/tuple_plus.pad_start.d.ts +8 -3
- package/esm/tuple/tuple_plus.pad_start.d.ts.map +1 -1
- package/package.json +15 -11
- package/ts/any/any_type.ts +8 -9
- package/ts/any/readme.md +91 -7
- package/ts/array/array.at.ts +3 -1
- package/ts/array/array.find.ts +3 -1
- package/ts/array/array.find_last.ts +3 -1
- package/ts/array/array.some.ts +1 -1
- package/ts/array/{array.concat.ts → array_plus.concat.ts} +3 -0
- package/ts/array/array_plus.filter.ts +5 -0
- package/ts/array/array_plus.pad_start.ts +13 -0
- package/ts/array/array_plus.ts +3 -2
- package/ts/array/array_type.ts +30 -12
- package/ts/array/filter.ts +27 -22
- package/ts/array/head.ts +18 -1
- package/ts/array/intersect_of_props.ts +7 -3
- package/ts/array/last.ts +16 -2
- package/ts/array/literal_array.ts +5 -0
- package/ts/array/pad_start.ts +6 -10
- package/ts/array/readme.md +181 -16
- package/ts/array/reduce_while.ts +6 -0
- package/ts/array/reverse.ts +5 -0
- package/ts/array/union_of_props.ts +1 -1
- package/ts/assertion/readme.md +3 -3
- package/ts/functional/compose.ts +2 -1
- package/ts/functional/context.ts +1 -1
- package/ts/index.ts +22 -3
- package/ts/math/numeric_struct.ts +9 -9
- package/ts/mix_types/any_or_never_type.ts +18 -10
- package/ts/mix_types/readme.md +40 -0
- package/ts/nodejs/isNodeError.ts +13 -13
- package/ts/nominal/brand.ts +1 -1
- package/ts/nominal/flavor.ts +1 -1
- package/ts/testing/readme.md +30 -0
- package/ts/testing/test_type.ts +90 -47
- package/ts/tuple/common_prop_keys.ts +55 -0
- package/ts/tuple/create_tuple.ts +9 -9
- package/ts/tuple/drop.ts +124 -0
- package/ts/tuple/readme.md +116 -1
- package/ts/{array → tuple}/tail.ts +1 -1
- package/ts/tuple/tuple_plus.filter.ts +29 -0
- package/ts/tuple/tuple_plus.pad_start.ts +26 -13
- package/ts/tuple/tuple_plus.ts +2 -1
- package/cjs/array/array.concat.d.ts.map +0 -1
- package/cjs/array/array.concat.js.map +0 -1
- package/cjs/array/common_prop_keys.d.ts +0 -11
- package/cjs/array/common_prop_keys.d.ts.map +0 -1
- package/cjs/array/common_prop_keys.js.map +0 -1
- package/cjs/array/drop.d.ts +0 -19
- package/cjs/array/drop.d.ts.map +0 -1
- package/cjs/array/drop.js.map +0 -1
- package/cjs/array/index.d.ts +0 -17
- package/cjs/array/index.d.ts.map +0 -1
- package/cjs/array/index.js +0 -33
- package/cjs/array/index.js.map +0 -1
- package/esm/array/array.concat.d.ts.map +0 -1
- package/esm/array/array.concat.js +0 -2
- package/esm/array/array.concat.js.map +0 -1
- package/esm/array/common_prop_keys.d.ts +0 -11
- package/esm/array/common_prop_keys.d.ts.map +0 -1
- package/esm/array/common_prop_keys.js.map +0 -1
- package/esm/array/drop.d.ts +0 -19
- package/esm/array/drop.d.ts.map +0 -1
- package/esm/array/drop.js +0 -7
- package/esm/array/drop.js.map +0 -1
- package/esm/array/index.d.ts +0 -17
- package/esm/array/index.d.ts.map +0 -1
- package/esm/array/index.js +0 -17
- package/esm/array/index.js.map +0 -1
- package/ts/array/common_prop_keys.ts +0 -18
- package/ts/array/drop.ts +0 -71
- package/ts/array/index.ts +0 -16
- /package/cjs/{array → tuple}/common_prop_keys.js +0 -0
- /package/cjs/{array → tuple}/tail.js +0 -0
- /package/esm/{array → tuple}/common_prop_keys.js +0 -0
- /package/esm/{array → tuple}/tail.js +0 -0
package/README.md
CHANGED
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
[![Visual Studio Code][vscode_image]][vscode_url]
|
|
10
10
|
|
|
11
|
-
More than 200 type utilities for [TypeScript].
|
|
11
|
+
More than 200 type utilities for [TypeScript] for applications, library, and type-level programming.
|
|
12
12
|
|
|
13
13
|
## Table of Contents
|
|
14
14
|
|
|
15
|
-
1. [
|
|
15
|
+
1. [What's in the package?](#whats-in-the-package)
|
|
16
|
+
1. [Update organization](#update-organization)
|
|
17
|
+
2. [Update documentation](#update-documentation)
|
|
18
|
+
2. [Assertion Function](#assertion-function)
|
|
16
19
|
1. [assertType](#asserttype)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
3. [Type Guard](#type-guard)
|
|
21
|
+
4. [Type Utilities](#type-utilities)
|
|
22
|
+
5. [Type Specific Utilities](#type-specific-utilities)
|
|
20
23
|
1. [any](#any)
|
|
21
24
|
2. [Array](#array)
|
|
22
25
|
3. [bigint](#bigint)
|
|
@@ -34,18 +37,18 @@ More than 200 type utilities for [TypeScript].
|
|
|
34
37
|
15. [undefined](#undefined)
|
|
35
38
|
16. [unknown](#unknown)
|
|
36
39
|
17. [void](#void)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
6. [Constant Types](#constant-types)
|
|
41
|
+
7. [JSON Support](#json-support)
|
|
42
|
+
8. [Type manipulation](#type-manipulation)
|
|
43
|
+
9. [Type Predicates](#type-predicates)
|
|
41
44
|
1. [Logical](#logical)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
10. [Math](#math)
|
|
46
|
+
11. [Utility Functions](#utility-functions)
|
|
47
|
+
12. [Nominal Types](#nominal-types)
|
|
48
|
+
13. [Functional Types](#functional-types)
|
|
49
|
+
14. [Attribution](#attribution)
|
|
50
|
+
15. [Useful Tips](#useful-tips)
|
|
51
|
+
16. [Similar projects](#similar-projects)
|
|
49
52
|
|
|
50
53
|
## Installation
|
|
51
54
|
|
|
@@ -57,6 +60,51 @@ yarn add type-plus
|
|
|
57
60
|
pnpm add type-plus
|
|
58
61
|
```
|
|
59
62
|
|
|
63
|
+
## What's in the package?
|
|
64
|
+
|
|
65
|
+
With over 200 types in [type-plus],
|
|
66
|
+
it can become difficult to find the types you need.
|
|
67
|
+
|
|
68
|
+
Also, some of the types need to be updated as TypeScript continue to evolve.
|
|
69
|
+
|
|
70
|
+
Currently, we are updating [type-plus] with the following objective:
|
|
71
|
+
|
|
72
|
+
- Update organization
|
|
73
|
+
- Update documentation
|
|
74
|
+
- Clean up and deprecate types
|
|
75
|
+
- Upgrade TypeScript from 5.0.4 to 5.1 (potential breaking changes)
|
|
76
|
+
|
|
77
|
+
### Update organization
|
|
78
|
+
|
|
79
|
+
Top-level exports of [type-plus] will contain types and functions that do not expect the input to be a specific type. For example,
|
|
80
|
+
|
|
81
|
+
- `assertType()`, `isType()`, and `testType()`
|
|
82
|
+
- Type filters and predicates such as `AnyType` or `IsArray`
|
|
83
|
+
|
|
84
|
+
It can also have types and functions for specific types if it is a common convention,
|
|
85
|
+
or the is no ambiguity, or for backwards compatibility purpose.
|
|
86
|
+
|
|
87
|
+
Other type specific utilities will be added under their respective `*Plus` namespaces such as `ArrayPlus.At` or `NumberPlus.Positive`.
|
|
88
|
+
|
|
89
|
+
### Update documentation
|
|
90
|
+
|
|
91
|
+
Each type and utility function in [type-plus] will be updated to include examples and tags to indicate its category and behavior.
|
|
92
|
+
|
|
93
|
+
Each tag has an associated icon:
|
|
94
|
+
|
|
95
|
+
- 👽 *alias* (:alien:): Alias of another type
|
|
96
|
+
- 🚦 *assertion* (:vertical_traffic_light:): assertion function
|
|
97
|
+
- 💀 *deprecated* (:skull:): deprecated and will be removed soon
|
|
98
|
+
- 🌪️ *filter* (:tornado:): a.k.a. *parse* These types perform some kind of test. If the input passes the test, the input is returned. Otherwise, it returns `never` (other icons considered: ↪️👉🚋⏩🐾🔑🚪💂🧲🙅♂️🪚)
|
|
99
|
+
- 🛡️ *guard* (:shield:): type guard function
|
|
100
|
+
- 💥 *immediate* (:boom:): The effect of the type can be observed immediately during development
|
|
101
|
+
- 🏃 *runtime* (:runner:): The function has runtime effect
|
|
102
|
+
- 🩳 *shortcut* (:shorts:): Shortcut or convenient types
|
|
103
|
+
- 🧪 *testing* (:test_tube:): The type or function are designed for test
|
|
104
|
+
- ⚗️ *transform* (:alembic:): These types transforms the input to another category
|
|
105
|
+
- 🦴 *utilities* (:bone:): provide various functionalities (other icons considered: 🔧🔨)
|
|
106
|
+
- 🎭 *validate* (:performing_arts:): a.k.a. *predicate* or *logical*. These types perform some kind of test. If the input passes the test, it returns `true` or `false` (other icons considered: ⭕)
|
|
107
|
+
|
|
60
108
|
## Assertion Function
|
|
61
109
|
|
|
62
110
|
[Assertion Functions][assertion_functions] are special functions that asserts certain conditions of your program.
|
|
@@ -325,151 +373,49 @@ You can learn more in their respective sections:
|
|
|
325
373
|
- [undefined](./ts/undefined/readme.md)
|
|
326
374
|
- [unknown](./ts/unknown/readme.md)
|
|
327
375
|
- [void](./ts/void/readme.md)
|
|
376
|
+
- [mix types](./ts/mix-types/readme.md)
|
|
328
377
|
|
|
329
|
-
### any
|
|
330
|
-
|
|
331
|
-
> [`AnyType<T>`](./ts/any/readme.md#type-checking)
|
|
332
|
-
|
|
333
|
-
↪️ `parse`: `T === any`.
|
|
378
|
+
### [any](./ts/any/readme.md)
|
|
334
379
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
↪️ `parse`: `T !== any`.
|
|
342
|
-
|
|
343
|
-
> [`IsNotAny<T>`](./ts/any/readme.md#type-checking)
|
|
344
|
-
|
|
345
|
-
⭕ `predicate`: `T !== any`.
|
|
346
|
-
|
|
347
|
-
> [`IsAnyOrNever<T>`](./ts/any/readme.md#type-utilities)
|
|
348
|
-
|
|
349
|
-
⭕ `predicate`: `T === any || T === never`.
|
|
380
|
+
- [`AnyType<T>`](./ts/any/readme.md#anytype)
|
|
381
|
+
- [`IsAny<T>`](./ts/any/readme.md#isany)
|
|
382
|
+
- [`NotAnyType<T>`](./ts/any/readme.md#notanytype)
|
|
383
|
+
- [`IsNotAny<T>`](./ts/any/readme.md#isnotany)
|
|
384
|
+
- [`AnyOrNeverType<T>`](./ts/mix_types/readme.md#anyornevertype)
|
|
385
|
+
- [`IsAnyOrNever<T>`](./ts/mix_types/readme.md#isanyornever)
|
|
350
386
|
|
|
351
387
|
### Array
|
|
352
388
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
🔨 `utilities`: creates `tuple<T>` with `L` number of elements.
|
|
384
|
-
|
|
385
|
-
> `drop(array, value)`
|
|
386
|
-
|
|
387
|
-
🔨 `utilities`: drop a particular value from an array.
|
|
388
|
-
|
|
389
|
-
> `DropFirst<A>`
|
|
390
|
-
|
|
391
|
-
🔨 `utilities`: drops the first value type of `A`.
|
|
392
|
-
|
|
393
|
-
> `DropLast<A>`
|
|
394
|
-
|
|
395
|
-
🔨 `utilities`: drops the last value type of `A`.
|
|
396
|
-
|
|
397
|
-
> `DropMatch<A, Criteria>`
|
|
398
|
-
|
|
399
|
-
🔨 `utilities`: drops entries matching `Criteria` in array or tuple `A`.
|
|
400
|
-
|
|
401
|
-
> `DropUndefined<A>`
|
|
402
|
-
|
|
403
|
-
🔨 `utilities`: drop undefined entries from array of tuple `A`.
|
|
404
|
-
|
|
405
|
-
> `Filter<A, Criteria>`
|
|
406
|
-
|
|
407
|
-
💀🔨 `deprecated`,`utilities`: filter the array or tuple `A`, keeping entries satisfying `Criteria`. **Deprecated. Renaming to `KeepMatch`**
|
|
408
|
-
|
|
409
|
-
> `FindFirst<A, Criteria>`
|
|
410
|
-
|
|
411
|
-
🔨 `utilities`: gets the first type satisfying `Criteria`.
|
|
412
|
-
|
|
413
|
-
> `FindLast<A, Criteria>`
|
|
414
|
-
|
|
415
|
-
🔨 `utilities`: gets the last type satisfying `Criteria`.
|
|
416
|
-
|
|
417
|
-
> `Head<A>`
|
|
418
|
-
|
|
419
|
-
🔨 `utilities`: gets the first entry in the array.
|
|
420
|
-
|
|
421
|
-
> `IntersectOfProps<A, K>`
|
|
422
|
-
|
|
423
|
-
🔨 `utilities`: gets the intersect of `A[K]` types (deprecate `MapToProp`)
|
|
424
|
-
|
|
425
|
-
> `KeepMatch<A, Criteria>`
|
|
426
|
-
|
|
427
|
-
🔨 `utilities`: keeps entries satisfying `Criteria` in array or tuple `A`.
|
|
428
|
-
|
|
429
|
-
> `Last<A>`
|
|
430
|
-
|
|
431
|
-
🔨 `utilities`: gets the last type of array or tuple.
|
|
432
|
-
|
|
433
|
-
> `literalArray(...entries)`
|
|
434
|
-
|
|
435
|
-
🔨 `utilities`: return an array whose items are restricted to the provided literals.
|
|
436
|
-
|
|
437
|
-
> `PadLeft<A, Total, PadWith>`
|
|
438
|
-
|
|
439
|
-
🔨 `utilities`: pads `A` with `PadWith` if the length of `A` is less than `L`.
|
|
440
|
-
|
|
441
|
-
> `reduceWhile()`
|
|
442
|
-
|
|
443
|
-
🔨 `utilities`: `reduce()` with predicate for early termination. \
|
|
444
|
-
A simple version of the same function in the `ramda` package.
|
|
445
|
-
|
|
446
|
-
> `Reverse<A>`
|
|
447
|
-
|
|
448
|
-
🔨 `utilities`: reverses the order of `A`.
|
|
449
|
-
|
|
450
|
-
> `Some<A, Criteria>`
|
|
451
|
-
|
|
452
|
-
🔨 `utilities`: true if some elements in `A` matches `Criteria`.
|
|
453
|
-
|
|
454
|
-
> `Tail<A>`
|
|
455
|
-
|
|
456
|
-
🔨 `utilities`: Gets the types of a tuple except the first entry.
|
|
457
|
-
|
|
458
|
-
> `UnionOfProps<A, K>`
|
|
459
|
-
|
|
460
|
-
🔨 `utilities`: gets the union of `A[K]` types (deprecate `PropUnion`).
|
|
461
|
-
|
|
462
|
-
> `UnionOfValues<A>`
|
|
463
|
-
|
|
464
|
-
🔨 `utilities`: gets the union of value types in `A` (deprecate `ArrayValue`).
|
|
465
|
-
|
|
466
|
-
> [`ArrayPlus.IndexAt<A, N, Fail = never>`](ts/array_plus/array_plus.ts#L23)
|
|
467
|
-
|
|
468
|
-
🔨 `utilities`: gets the normalized index for `A`.
|
|
469
|
-
|
|
470
|
-
> [`ArrayPlus.IsIndexOutOfBound<A, N, Then = true, Else = false>`](ts/array_plus/array_plus.ts#L62)
|
|
471
|
-
|
|
472
|
-
⭕ `predicate`: is `N` an out of bound index of `A`. Supports negative numbers.
|
|
389
|
+
- [`ArrayType<T>`](./ts/array/readme.md#arraytype)
|
|
390
|
+
- [`IsArray<T>`](./ts/array/readme.md#isarray)
|
|
391
|
+
- [`NotArrayType<T>`](./ts/array/readme.md#notarraytype)
|
|
392
|
+
- [`IsNotArrayType<T>`](./ts/array/readme.md#isnotarraytype)
|
|
393
|
+
- [`At<T>`](./ts/array/readme.md#at)
|
|
394
|
+
- [`Concat<T>`](./ts/array/readme.md#concat)
|
|
395
|
+
- [`FindFirst<T>`](./ts/array/readme.md#findfirst)
|
|
396
|
+
- [`FindLast<T>`](./ts/array/readme.md#findlast)
|
|
397
|
+
- [`Some<T>`](./ts/array/readme.md#some)
|
|
398
|
+
- [`Filter<T>`](./ts/array/readme.md#filter)
|
|
399
|
+
- [`KeepMatch<T>`](./ts/array/readme.md#keepmatch)
|
|
400
|
+
- [`Head<T>`](./ts/array/readme.md#head)
|
|
401
|
+
- [`IntersectOfProps<T>`](./ts/array/readme.md#intersectofprops)
|
|
402
|
+
- [`MapToProp<T>`](./ts/array/readme.md#maptoprop)
|
|
403
|
+
- [`Last<T>`](./ts/array/readme.md#last)
|
|
404
|
+
- [`literalArray<T>`](./ts/array/readme.md#literalarray)
|
|
405
|
+
- [`PadStart<T>`](./ts/array/readme.md#padstart)
|
|
406
|
+
- [`reduceWhile`](./ts/array/readme.md#reducewhile)
|
|
407
|
+
- [`Reverse<T>`](./ts/array/readme.md#reverse)
|
|
408
|
+
- [`PropUnion<T>`](./ts/array/readme.md#propunion)
|
|
409
|
+
- [`UnionOfProps<T>`](./ts/array/readme.md#unionofprops)
|
|
410
|
+
- [`UnionOfValues<T>`](./ts/array/readme.md#unionofvalues)
|
|
411
|
+
- [`ArrayPlus.At<T>`](./ts/array/readme.md#arrayplusat)
|
|
412
|
+
- [`ArrayPlus.Concat<T>`](./ts/array/readme.md#arrayplusconcat)
|
|
413
|
+
- [`ArrayPlus.Entries<T>`](./ts/array/readme.md#arrayplusentries)
|
|
414
|
+
- [`ArrayPlus.Find<T>`](./ts/array/readme.md#arrayplusfind)
|
|
415
|
+
- [`ArrayPlus.FindLast<T>`](./ts/array/readme.md#arrayplusfindlast)
|
|
416
|
+
- [`ArrayPlus.Reverse<T>`](./ts/array/readme.md#arrayplusreverse)
|
|
417
|
+
- [`ArrayPlus.SplitAt<T>`](./ts/array/readme.md#arrayplussplitat)
|
|
418
|
+
- [`ArrayPlus.Some<T>`](./ts/array/readme.md#arrayplussome)
|
|
473
419
|
|
|
474
420
|
### bigint
|
|
475
421
|
|
|
@@ -827,6 +773,34 @@ You can learn more in their respective sections:
|
|
|
827
773
|
|
|
828
774
|
⭕ `predicate`: is not a tuple.
|
|
829
775
|
|
|
776
|
+
> `CommonPropKeys<A>`
|
|
777
|
+
|
|
778
|
+
🔨 `utilities`: gets common keys inside the records in the array `A` (deprecate `CommonKeys`).
|
|
779
|
+
|
|
780
|
+
> `CreateTuple<L, T>`
|
|
781
|
+
|
|
782
|
+
🔨 `utilities`: creates `tuple<T>` with `L` number of elements.
|
|
783
|
+
|
|
784
|
+
> `drop(array, value)`
|
|
785
|
+
|
|
786
|
+
🔨 `utilities`: drop a particular value from an array.
|
|
787
|
+
|
|
788
|
+
> `DropFirst<A>`
|
|
789
|
+
|
|
790
|
+
🔨 `utilities`: drops the first value type of `A`.
|
|
791
|
+
|
|
792
|
+
> `DropLast<A>`
|
|
793
|
+
|
|
794
|
+
🔨 `utilities`: drops the last value type of `A`.
|
|
795
|
+
|
|
796
|
+
> `DropMatch<A, Criteria>`
|
|
797
|
+
|
|
798
|
+
🔨 `utilities`: drops entries matching `Criteria` in array or tuple `A`.
|
|
799
|
+
|
|
800
|
+
> `DropUndefined<A>`
|
|
801
|
+
|
|
802
|
+
🔨 `utilities`: drop undefined entries from array of tuple `A`.
|
|
803
|
+
|
|
830
804
|
### undefined
|
|
831
805
|
|
|
832
806
|
> [`UndefinedType<T>`](./ts/undefined/readme.md#type-checking)
|
|
@@ -1380,6 +1354,7 @@ Whenever possible, I add attribution to the person who created those **codes** i
|
|
|
1380
1354
|
[ts-expect]: https://github.com/TypeStrong/ts-expect
|
|
1381
1355
|
[ts-toolbelt]: https://github.com/millsp/ts-toolbelt
|
|
1382
1356
|
[type-fest]: https://github.com/sindresorhus/type-fest
|
|
1357
|
+
[type-plus]: https://github.com/unional/type-plus
|
|
1383
1358
|
[type-zoo]: https://github.com/pelotom/type-zoo
|
|
1384
1359
|
[typelevel-ts]: https://github.com/gcanti/typelevel-ts
|
|
1385
1360
|
[typepark]: https://github.com/kgtkr/typepark
|
package/cjs/any/any_type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 🌪️ *filter*
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Filter `T` to ensure it is exactly `any`.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```ts
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export type AnyType<T, Then = T, Else = never> = 0 extends 1 & T ? Then : Else;
|
|
16
16
|
/**
|
|
17
|
-
* Validate if `T` is exactly `any`.
|
|
18
|
-
*
|
|
19
17
|
* 🎭 *validate*
|
|
20
18
|
*
|
|
19
|
+
* Validate if `T` is exactly `any`.
|
|
20
|
+
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
23
|
* type R = IsAny<any> // true
|
|
@@ -29,9 +29,9 @@ export type AnyType<T, Then = T, Else = never> = 0 extends 1 & T ? Then : Else;
|
|
|
29
29
|
*/
|
|
30
30
|
export type IsAny<T, Then = true, Else = false> = AnyType<T, Then, Else>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* 🌪️ *filter*
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* Filter `T` to ensure it is not exactly `any`.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```ts
|
|
@@ -44,10 +44,10 @@ export type IsAny<T, Then = true, Else = false> = AnyType<T, Then, Else>;
|
|
|
44
44
|
*/
|
|
45
45
|
export type NotAnyType<T, Then = T, Else = never> = AnyType<T, Else, Then>;
|
|
46
46
|
/**
|
|
47
|
-
* Validate if `T` is not exactly `any`.
|
|
48
|
-
*
|
|
49
47
|
* 🎭 *validate*
|
|
50
48
|
*
|
|
49
|
+
* Validate if `T` is not exactly `any`.
|
|
50
|
+
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```ts
|
|
53
53
|
* import type { IsNotAny } from 'type-plus'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any_type.d.ts","sourceRoot":"","sources":["../../ts/any/any_type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"any_type.d.ts","sourceRoot":"","sources":["../../ts/any/any_type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAExE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE1E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|
package/cjs/array/array.at.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { IsStrictNumber } from '../number/strict_number_type.js';
|
|
|
2
2
|
import type { TupleType } from '../tuple/tuple_type.js';
|
|
3
3
|
import type { IndexAt } from './array_index.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 🦴 *utilities*
|
|
6
|
+
*
|
|
7
|
+
* Gets the type of the array or tuple at positive or negative index `N`.
|
|
6
8
|
*
|
|
7
9
|
* Like `Array.at()`, this type supports negative numbers.
|
|
8
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.at.d.ts","sourceRoot":"","sources":["../../ts/array/array.at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C
|
|
1
|
+
{"version":3,"file":"array.at.d.ts","sourceRoot":"","sources":["../../ts/array/array.at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,MAAM,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAC5E,CAAC,EACD,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,IAAI,CACJ,SAAS,MAAM,CAAC,GACd,CAAC,SAAS,MAAM,GACf,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GACzE,IAAI,GACL,KAAK,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { TupleType } from '../tuple/tuple_type.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 🦴 *utilities*
|
|
4
|
+
*
|
|
5
|
+
* Gets the first type in the array or tuple that matches the `Criteria`.
|
|
4
6
|
*
|
|
5
7
|
* If the `Criteria` is not met, it will return `never'.
|
|
6
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD
|
|
1
|
+
{"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { TupleType } from '../tuple/tuple_type.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 🦴 *utilities*
|
|
4
|
+
*
|
|
5
|
+
* Gets the last type in the array or tuple that matches the `Criteria`.
|
|
4
6
|
*
|
|
5
7
|
* If the `Criteria` is not met, it will return `never'.
|
|
6
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.find_last.d.ts","sourceRoot":"","sources":["../../ts/array/array.find_last.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD
|
|
1
|
+
{"version":3,"file":"array.find_last.d.ts","sourceRoot":"","sources":["../../ts/array/array.find_last.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,GAAG,MAAM,KAAK,EAAE,MAAM,IAAI,CAAC,GACtC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IsEqual } from '../equal/equal.js';
|
|
2
2
|
import type { CanAssign } from '../index.js';
|
|
3
|
-
import type { Tail } from '
|
|
3
|
+
import type { Tail } from '../tuple/tail.js';
|
|
4
4
|
import type { UnionOfValues } from './union_of_values.js';
|
|
5
5
|
/**
|
|
6
6
|
* Determines whether the array type `A` contains any elements that satisfies the specified `Criteria` type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.some.d.ts","sourceRoot":"","sources":["../../ts/array/array.some.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"array.some.d.ts","sourceRoot":"","sources":["../../ts/array/array.some.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,IAAI,CACf,CAAC,SAAS,GAAG,EAAE,EACf,QAAQ,EACR,IAAI,SAAS,QAAQ,GAAG,OAAO,GAAG,OAAO,EACzC,IAAI,GAAG,IAAI,EACX,IAAI,GAAG,KAAK,IACT,IAAI,SAAS,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEtG,yBAAiB,IAAI,CAAC;IACrB,KAAY,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GACvF,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,GACpC,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAEvC,KAAY,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,OAAO,CAC3E,aAAa,CAAC,CAAC,CAAC,EAChB,QAAQ,EACR,IAAI,EACJ,IAAI,CACJ,CAAA;IAED,KAAY,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvF,IAAI,GACJ,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,IAAI,GACpC,IAAI,GACJ,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAE7C,KAAY,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GACtF,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,GACnC,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAEtC,KAAY,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,SAAS,CAC5E,aAAa,CAAC,CAAC,CAAC,EAChB,QAAQ,EACR,IAAI,EACJ,IAAI,CACJ,CAAA;IAED,KAAY,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACtF,IAAI,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GACrB,IAAI,GACJ,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;CAC5C"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* 🦴 *utilities
|
|
3
|
+
* 💀 *deprecated* Will be available only as `ArrayPlus.Concat` in the next version
|
|
4
|
+
*
|
|
2
5
|
* Concats two arrays or tuples.
|
|
3
6
|
*
|
|
4
7
|
* alias of: `[...A, ...B]`
|
|
@@ -10,4 +13,4 @@
|
|
|
10
13
|
* ```
|
|
11
14
|
*/
|
|
12
15
|
export type Concat<A extends unknown[], B extends unknown[]> = [...A, ...B];
|
|
13
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=array_plus.concat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.concat.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.concat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.concat.js","sourceRoot":"","sources":["../../ts/array/array_plus.concat.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export type { At } from './array.at.js';
|
|
2
|
-
export type { Concat } from './
|
|
2
|
+
export type { Concat } from './array_plus.concat.js';
|
|
3
3
|
export type { Entries } from './array.entries.js';
|
|
4
4
|
export type { FindFirst as Find } from './array.find.js';
|
|
5
5
|
export type { FindLast } from './array.find_last.js';
|
|
6
6
|
export type { Reverse } from './array.reverse.js';
|
|
7
7
|
export type { Some } from './array.some.js';
|
|
8
8
|
export type { IndexAt, IsIndexOutOfBound } from './array_index.js';
|
|
9
|
+
export type { Filter } from './array_plus.filter.js';
|
|
9
10
|
export type { SplitAt } from './array_plus.split_at.js';
|
|
10
|
-
export type { PadStart } from './pad_start.js';
|
|
11
|
+
export type { PadStart } from './array_plus.pad_start.js';
|
|
11
12
|
//# sourceMappingURL=array_plus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_plus.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AACvC,YAAY,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"array_plus.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AACvC,YAAY,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,YAAY,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACxD,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAClE,YAAY,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.filter.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.filter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GACtE,CAAC,GACD,QAAQ,SAAS,CAAC,CAAC,CAAC,CAAC,GACrB,KAAK,CAAC,QAAQ,CAAC,GACf,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.filter.js","sourceRoot":"","sources":["../../ts/array/array_plus.filter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CanAssign } from '../index.js';
|
|
2
|
+
import type { CreateTuple } from '../tuple/create_tuple.js';
|
|
3
|
+
import type { UnionOfValues } from './union_of_values.js';
|
|
4
|
+
export type PadStart<A extends unknown[], MaxLength extends number, PadWith = unknown> = MaxLength extends 0 ? A : CanAssign<PadWith, UnionOfValues<A>> extends true ? A : PadStart<[...CreateTuple<MaxLength, PadWith>, ...A], MaxLength, PadWith>;
|
|
5
|
+
//# sourceMappingURL=array_plus.pad_start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.pad_start.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.pad_start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,MAAM,QAAQ,CACnB,CAAC,SAAS,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EACxB,OAAO,GAAG,OAAO,IACd,SAAS,SAAS,CAAC,GACpB,CAAC,GACD,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACjD,CAAC,GACD,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_plus.pad_start.js","sourceRoot":"","sources":["../../ts/array/array_plus.pad_start.ts"],"names":[],"mappings":""}
|
|
@@ -1,42 +1,60 @@
|
|
|
1
1
|
import type { IsNever } from '../never/never_type.js';
|
|
2
2
|
import type { StrictNumberType } from '../number/strict_number_type.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 🌪️ *filter*
|
|
5
5
|
*
|
|
6
|
+
* Filter `T` to ensure it is an array, excluding tuple.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
6
9
|
* ```ts
|
|
7
10
|
* type R = ArrayType<number[]> // number[]
|
|
8
11
|
*
|
|
9
12
|
* type R = ArrayType<[1]> // never
|
|
13
|
+
* type R = ArrayType<number[] | 1> // never
|
|
14
|
+
* type R = ArrayType<number[] & { a: 1 }> // never
|
|
10
15
|
* ```
|
|
11
16
|
*/
|
|
12
17
|
export type ArrayType<T, Then = T, Else = never> = IsNever<T, Else, [
|
|
13
18
|
any[]
|
|
14
19
|
] extends [T] ? ([T] extends [any[]] ? StrictNumberType<T['length'], Then, Else> : Else) : Else>;
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
21
|
+
* 🎭 *validate*
|
|
22
|
+
*
|
|
23
|
+
* Validate that `T` is an array, excluding tuple.
|
|
17
24
|
*
|
|
25
|
+
* @example
|
|
18
26
|
* ```ts
|
|
19
|
-
* type R =
|
|
27
|
+
* type R = IsArray<number[]> // true
|
|
20
28
|
*
|
|
21
|
-
* type R =
|
|
22
|
-
* type R =
|
|
29
|
+
* type R = IsArray<number> // false
|
|
30
|
+
* type R = IsArray<[1]> // false
|
|
23
31
|
* ```
|
|
24
32
|
*/
|
|
25
|
-
export type
|
|
33
|
+
export type IsArray<T, Then = true, Else = false> = ArrayType<T, Then, Else>;
|
|
26
34
|
/**
|
|
27
|
-
*
|
|
35
|
+
* 🌪️ *filter*
|
|
36
|
+
*
|
|
37
|
+
* Filter `T` to ensure it is not an array, excluding tuple.
|
|
28
38
|
*
|
|
39
|
+
* i.e. *tuple* will pass through this filter.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
29
42
|
* ```ts
|
|
30
|
-
* type R =
|
|
43
|
+
* type R = NotArrayType<number[]> // never
|
|
31
44
|
*
|
|
32
|
-
* type R =
|
|
33
|
-
* type R =
|
|
45
|
+
* type R = NotArrayType<number> // number
|
|
46
|
+
* type R = NotArrayType<[1]> // [1]
|
|
34
47
|
* ```
|
|
35
48
|
*/
|
|
36
|
-
export type
|
|
49
|
+
export type NotArrayType<T, Then = T, Else = never> = ArrayType<T, Else, Then>;
|
|
37
50
|
/**
|
|
38
|
-
*
|
|
51
|
+
* 🎭 *validate*
|
|
52
|
+
*
|
|
53
|
+
* Validate that `T` is not an array, excluding tuple.
|
|
54
|
+
*
|
|
55
|
+
* i.e. *tuple* will pass through this filter.
|
|
39
56
|
*
|
|
57
|
+
* @example
|
|
40
58
|
* ```ts
|
|
41
59
|
* type R = IsNotArray<number[]> // false
|
|
42
60
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_type.d.ts","sourceRoot":"","sources":["../../ts/array/array_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE
|
|
1
|
+
{"version":3,"file":"array_type.d.ts","sourceRoot":"","sources":["../../ts/array/array_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CACzD,CAAC,EACD,IAAI,EACJ;IAAC,GAAG,EAAE;CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CACrG,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
|