mol_type_all 0.0.1827 → 0.0.1829
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 +82 -12
- package/node.d.ts +516 -21
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +63 -0
- package/node.js.map +1 -1
- package/node.meta.tree +24 -2
- package/node.mjs +63 -0
- package/node.test.js +129 -0
- package/node.test.js.map +1 -1
- package/package.json +39 -10
- package/web.d.ts +516 -21
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +63 -0
- package/web.js.map +1 -1
- package/web.meta.tree +24 -2
- package/web.mjs +63 -0
- package/web.test.js +66 -0
- package/web.test.js.map +1 -1
package/README.md
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Collection of TypeScript meta types for complex logic.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## MAM
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
type
|
|
11
|
-
$
|
|
12
|
-
|
|
10
|
+
type cutted_head = $mol_type_assert<
|
|
11
|
+
$mol_type_tail<[ 1, 2, 3 ]>,
|
|
12
|
+
[ 2, 3 ]
|
|
13
13
|
>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## NPM
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
npm install mol_type_all
|
|
@@ -21,17 +21,87 @@ npm install mol_type_all
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import {
|
|
24
|
-
$mol_type_assert as Assert
|
|
25
|
-
$
|
|
24
|
+
$mol_type_assert as Assert,
|
|
25
|
+
$mol_type_tail as Tail,
|
|
26
26
|
} from 'mol_type_all'
|
|
27
27
|
|
|
28
|
-
type
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
type cutted_head = Assert<
|
|
29
|
+
Tail<[ 1, 2, 3 ]>,
|
|
30
|
+
[ 2, 3 ]
|
|
31
31
|
>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
# Utilite types
|
|
35
|
+
|
|
36
|
+
## Assertions
|
|
37
|
+
|
|
38
|
+
- [$mol_type_error](./error) - special type for errors with details.
|
|
39
|
+
- [$mol_type_assert](./assert) - fails type check on type inequality.
|
|
40
|
+
- [$mol_type_enforce](./enforce) - fails type check on type incompatibility.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Actual result
|
|
44
|
+
type partial_record = $mol_type_assert<
|
|
45
|
+
Partial<{ foo: 123 }>, // Some expression
|
|
46
|
+
{ foo?: 123 } // Expected result
|
|
47
|
+
>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
## Tuples
|
|
53
|
+
|
|
54
|
+
- [$mol_type_head](./head) - first item of tuple or never.
|
|
55
|
+
- [$mol_type_head_write](./head/write) - replaces first element of tuple.
|
|
56
|
+
- [$mol_type_tail](./tail) - tuple without first item.
|
|
57
|
+
- [$mol_type_foot](./foot) - last item of tuple or never.
|
|
58
|
+
- [$mol_type_reverse](./reverse) - makes reversed tuple.
|
|
59
|
+
|
|
60
|
+
## Algebraics
|
|
61
|
+
|
|
62
|
+
- [$mol_type_equals](./equals) - check for types equality.
|
|
63
|
+
- [$mol_type_access](./access) - takes type of property from wild union type.
|
|
64
|
+
- [$mol_type_filter_keys](./filter/keys) - records from union with provided property.
|
|
65
|
+
- [$mol_type_intersect](./intersect) - converts union to intersection.
|
|
66
|
+
- [$mol_type_merge](./merge) - merges intersection of records to one record.
|
|
67
|
+
- [$mol_type_keys_all](./keys/all) - all keys from all records from union.
|
|
68
|
+
|
|
69
|
+
## Strings
|
|
70
|
+
|
|
71
|
+
- [$mol_type_alphabet_*](./alphabet) - character classes.
|
|
72
|
+
- [$mol_type_string_split](./string/split) - splits string by separator.
|
|
73
|
+
- [$mol_type_string_join](./string/join) - joins strings by separator.
|
|
74
|
+
|
|
75
|
+
## Numbers
|
|
76
|
+
|
|
77
|
+
- [$mol_type_int_*](./int) - integer arithmetic (`+`, `-`, `*`, `/`, `^`, `..`, `()`, `<`)
|
|
78
|
+
|
|
79
|
+
## Functions
|
|
80
|
+
|
|
81
|
+
- [$mol_type_unary](./unary) - function/class with single param.
|
|
82
|
+
- [$mol_type_param](./param) - takes param type by index.
|
|
83
|
+
- [$mol_type_result](./result) - takes result/instance type.
|
|
84
|
+
|
|
85
|
+
## Records
|
|
86
|
+
|
|
87
|
+
- [$mol_type_immutable_deep](./immutable/deep) - recursive immutability.
|
|
88
|
+
- [$mol_type_mutable_deep](./mutable/deep) - recursive mutability.
|
|
89
|
+
- [$mol_type_partial_undefined](./partial/undefined) - makes all properties partial.
|
|
90
|
+
- [$mol_type_partial_deep](./partial/deep) - makes all properties partial deeply.
|
|
91
|
+
- [$mol_type_required_deep](./required/deep) - makes all properties required deeply.
|
|
92
|
+
- [$mol_type_nullable](./nullable) - makes all properties nullable.
|
|
93
|
+
- [$mol_type_writable](./writable) - makes all properties writable.
|
|
94
|
+
- [$mol_type_keys_extract](./keys/extract) - extracts key names from record by value type.
|
|
95
|
+
- [$mol_type_keys_exclude](./keys/exclude) - excludes key names from record by value type.
|
|
96
|
+
- [$mol_type_omit](./omit) - omits properties by value type.
|
|
97
|
+
- [$mol_type_pick](./pick) - pick properties by value type.
|
|
98
|
+
- [$mol_type_override](./override) - fully replaces properties.
|
|
99
|
+
- [$mol_type_case_*](./case) - converts keys/values to upper/lower/capital cases.
|
|
100
|
+
|
|
101
|
+
- [$mol_type_flat_camel](./flat/camel) - makes flat record from volume records tree.
|
|
102
|
+
- [$mol_type_flat_keys](./flat/keys) - takes keys paths from volume records tree.
|
|
103
|
+
- [$mol_type_volume](./volume) - makes volume records tree from flat record.
|
|
104
|
+
- [$mol_type_volume_value](./volume/value) - takes value from volume records tree by path.
|
|
35
105
|
|
|
36
106
|
# Similar Projects
|
|
37
107
|
|