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 CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Collection of TypeScript meta types for complex logic.
4
4
 
5
- ![Type Asserts](https://i.imgur.com/CNI5KvX.png)
5
+ # Usage
6
6
 
7
- # MAM Usage
7
+ ## MAM
8
8
 
9
9
  ```typescript
10
- type first_of_tuple = $mol_type_assert<
11
- $mol_type_head<[ 1 , 2 , 3 ]> ,
12
- 1
10
+ type cutted_head = $mol_type_assert<
11
+ $mol_type_tail<[ 1, 2, 3 ]>,
12
+ [ 2, 3 ]
13
13
  >
14
14
  ```
15
15
 
16
- # NPM usage
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
- $mol_type_head as Head ,
24
+ $mol_type_assert as Assert,
25
+ $mol_type_tail as Tail,
26
26
  } from 'mol_type_all'
27
27
 
28
- type first_of_tuple = Assert<
29
- Head<[ 1 , 2 , 3 ]> ,
30
- 1
28
+ type cutted_head = Assert<
29
+ Tail<[ 1, 2, 3 ]>,
30
+ [ 2, 3 ]
31
31
  >
32
32
  ```
33
33
 
34
- [![Edit $mol_type example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/moltype-example-1ebxp)
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
+ ![Type Asserts](https://habrastorage.org/webt/a4/d3/d6/a4d3d643f36e4ac3f431b9dac7a1f2c5.png)
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