@twin.org/core 0.0.1-next.9 → 0.0.2-next.3
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/dist/cjs/index.cjs +1574 -833
- package/dist/esm/index.mjs +1571 -834
- package/dist/types/errors/baseError.d.ts +8 -1
- package/dist/types/factories/factory.d.ts +20 -1
- package/dist/types/helpers/arrayHelper.d.ts +13 -0
- package/dist/types/helpers/envHelper.d.ts +16 -0
- package/dist/types/helpers/errorHelper.d.ts +2 -1
- package/dist/types/helpers/jsonHelper.d.ts +30 -0
- package/dist/types/helpers/objectHelper.d.ts +25 -0
- package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/models/IComponent.d.ts +12 -3
- package/dist/types/models/II18nShared.d.ts +29 -0
- package/dist/types/models/coerceType.d.ts +49 -0
- package/dist/types/models/compressionType.d.ts +1 -1
- package/dist/types/models/objectOrArray.d.ts +4 -0
- package/dist/types/utils/asyncCache.d.ts +10 -1
- package/dist/types/utils/coerce.d.ts +22 -0
- package/dist/types/utils/guards.d.ts +35 -0
- package/dist/types/utils/is.d.ts +12 -0
- package/dist/types/utils/sharedStore.d.ts +23 -0
- package/dist/types/utils/validation.d.ts +2 -0
- package/docs/changelog.md +323 -1
- package/docs/reference/classes/AlreadyExistsError.md +103 -27
- package/docs/reference/classes/ArrayHelper.md +71 -5
- package/docs/reference/classes/AsyncCache.md +75 -13
- package/docs/reference/classes/Base32.md +9 -5
- package/docs/reference/classes/Base58.md +9 -5
- package/docs/reference/classes/Base64.md +12 -6
- package/docs/reference/classes/Base64Url.md +9 -5
- package/docs/reference/classes/BaseError.md +101 -29
- package/docs/reference/classes/BitString.md +23 -11
- package/docs/reference/classes/Coerce.md +110 -12
- package/docs/reference/classes/Compression.md +19 -11
- package/docs/reference/classes/ConflictError.md +106 -28
- package/docs/reference/classes/Converter.md +72 -28
- package/docs/reference/classes/EnvHelper.md +45 -0
- package/docs/reference/classes/ErrorHelper.md +19 -7
- package/docs/reference/classes/Factory.md +95 -17
- package/docs/reference/classes/FilenameHelper.md +6 -4
- package/docs/reference/classes/GeneralError.md +101 -27
- package/docs/reference/classes/GuardError.md +106 -28
- package/docs/reference/classes/Guards.md +398 -80
- package/docs/reference/classes/HexHelper.md +18 -8
- package/docs/reference/classes/I18n.md +46 -20
- package/docs/reference/classes/Is.md +179 -51
- package/docs/reference/classes/JsonHelper.md +146 -10
- package/docs/reference/classes/NotFoundError.md +103 -27
- package/docs/reference/classes/NotImplementedError.md +97 -25
- package/docs/reference/classes/NotSupportedError.md +100 -26
- package/docs/reference/classes/ObjectHelper.md +197 -39
- package/docs/reference/classes/RandomHelper.md +6 -4
- package/docs/reference/classes/SharedStore.md +94 -0
- package/docs/reference/classes/StringHelper.md +54 -20
- package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
- package/docs/reference/classes/UnauthorizedError.md +100 -26
- package/docs/reference/classes/UnprocessableError.md +101 -27
- package/docs/reference/classes/Url.md +37 -17
- package/docs/reference/classes/Urn.md +63 -27
- package/docs/reference/classes/Validation.md +349 -135
- package/docs/reference/classes/ValidationError.md +100 -26
- package/docs/reference/index.md +7 -0
- package/docs/reference/interfaces/IComponent.md +30 -8
- package/docs/reference/interfaces/IError.md +2 -2
- package/docs/reference/interfaces/II18nShared.md +47 -0
- package/docs/reference/interfaces/IKeyValue.md +3 -1
- package/docs/reference/interfaces/ILabelledValue.md +3 -1
- package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
- package/docs/reference/interfaces/IPatchOperation.md +1 -1
- package/docs/reference/interfaces/IValidationFailure.md +1 -1
- package/docs/reference/type-aliases/CoerceType.md +5 -0
- package/docs/reference/type-aliases/CompressionType.md +1 -1
- package/docs/reference/type-aliases/ObjectOrArray.md +11 -0
- package/docs/reference/variables/CoerceType.md +67 -0
- package/docs/reference/variables/CompressionType.md +1 -1
- package/locales/en.json +14 -1
- package/package.json +7 -7
|
@@ -8,33 +8,39 @@ Class to handle errors when a feature is unsupported.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new NotSupportedError**(`source`, `message`, `inner
|
|
13
|
+
> **new NotSupportedError**(`source`, `message`, `inner?`): `NotSupportedError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of NotSupportedError.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### source
|
|
20
|
+
|
|
21
|
+
`string`
|
|
20
22
|
|
|
21
23
|
The source of the error.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### message
|
|
26
|
+
|
|
27
|
+
`string`
|
|
24
28
|
|
|
25
29
|
The message as a code.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
##### inner?
|
|
32
|
+
|
|
33
|
+
`unknown`
|
|
28
34
|
|
|
29
35
|
The inner error if we have wrapped another error.
|
|
30
36
|
|
|
31
37
|
#### Returns
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
`NotSupportedError`
|
|
34
40
|
|
|
35
41
|
#### Overrides
|
|
36
42
|
|
|
37
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
43
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
38
44
|
|
|
39
45
|
## Properties
|
|
40
46
|
|
|
@@ -58,7 +64,7 @@ Any additional information for the error.
|
|
|
58
64
|
|
|
59
65
|
#### Index Signature
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
\[`id`: `string`\]: `unknown`
|
|
62
68
|
|
|
63
69
|
#### Inherited from
|
|
64
70
|
|
|
@@ -94,7 +100,9 @@ Construct an error from an existing one.
|
|
|
94
100
|
|
|
95
101
|
#### Parameters
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
##### err
|
|
104
|
+
|
|
105
|
+
`unknown`
|
|
98
106
|
|
|
99
107
|
The existing error.
|
|
100
108
|
|
|
@@ -118,7 +126,9 @@ Flatten an error tree.
|
|
|
118
126
|
|
|
119
127
|
#### Parameters
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
##### err
|
|
130
|
+
|
|
131
|
+
`unknown`
|
|
122
132
|
|
|
123
133
|
The starting error.
|
|
124
134
|
|
|
@@ -142,10 +152,12 @@ Expand an error tree.
|
|
|
142
152
|
|
|
143
153
|
#### Parameters
|
|
144
154
|
|
|
145
|
-
|
|
155
|
+
##### errors
|
|
146
156
|
|
|
147
157
|
The list of errors to expand.
|
|
148
158
|
|
|
159
|
+
`undefined` | [`IError`](../interfaces/IError.md)[]
|
|
160
|
+
|
|
149
161
|
#### Returns
|
|
150
162
|
|
|
151
163
|
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
@@ -166,14 +178,18 @@ Test to see if the error has the specified error name.
|
|
|
166
178
|
|
|
167
179
|
#### Parameters
|
|
168
180
|
|
|
169
|
-
|
|
181
|
+
##### error
|
|
182
|
+
|
|
183
|
+
`unknown`
|
|
170
184
|
|
|
171
185
|
The error to test.
|
|
172
186
|
|
|
173
|
-
|
|
187
|
+
##### name
|
|
174
188
|
|
|
175
189
|
The name to check for.
|
|
176
190
|
|
|
191
|
+
`string` | `RegExp`
|
|
192
|
+
|
|
177
193
|
#### Returns
|
|
178
194
|
|
|
179
195
|
`error is BaseError`
|
|
@@ -194,14 +210,18 @@ Test to see if the error has the specified error message.
|
|
|
194
210
|
|
|
195
211
|
#### Parameters
|
|
196
212
|
|
|
197
|
-
|
|
213
|
+
##### error
|
|
214
|
+
|
|
215
|
+
`unknown`
|
|
198
216
|
|
|
199
217
|
The error to test.
|
|
200
218
|
|
|
201
|
-
|
|
219
|
+
##### message
|
|
202
220
|
|
|
203
221
|
The message to check for.
|
|
204
222
|
|
|
223
|
+
`string` | `RegExp`
|
|
224
|
+
|
|
205
225
|
#### Returns
|
|
206
226
|
|
|
207
227
|
`error is BaseError`
|
|
@@ -222,14 +242,18 @@ Test to see if the error has the specified error code.
|
|
|
222
242
|
|
|
223
243
|
#### Parameters
|
|
224
244
|
|
|
225
|
-
|
|
245
|
+
##### error
|
|
246
|
+
|
|
247
|
+
`unknown`
|
|
226
248
|
|
|
227
249
|
The error to test.
|
|
228
250
|
|
|
229
|
-
|
|
251
|
+
##### code
|
|
230
252
|
|
|
231
253
|
The code to check for.
|
|
232
254
|
|
|
255
|
+
`string` | `RegExp`
|
|
256
|
+
|
|
233
257
|
#### Returns
|
|
234
258
|
|
|
235
259
|
`boolean`
|
|
@@ -250,14 +274,18 @@ Test to see if any of the errors or children have the given error name.
|
|
|
250
274
|
|
|
251
275
|
#### Parameters
|
|
252
276
|
|
|
253
|
-
|
|
277
|
+
##### error
|
|
278
|
+
|
|
279
|
+
`unknown`
|
|
254
280
|
|
|
255
281
|
The error to test.
|
|
256
282
|
|
|
257
|
-
|
|
283
|
+
##### name
|
|
258
284
|
|
|
259
285
|
The name to check for.
|
|
260
286
|
|
|
287
|
+
`string` | `RegExp`
|
|
288
|
+
|
|
261
289
|
#### Returns
|
|
262
290
|
|
|
263
291
|
`error is BaseError`
|
|
@@ -278,14 +306,18 @@ Test to see if any of the errors or children have the given error message.
|
|
|
278
306
|
|
|
279
307
|
#### Parameters
|
|
280
308
|
|
|
281
|
-
|
|
309
|
+
##### error
|
|
310
|
+
|
|
311
|
+
`unknown`
|
|
282
312
|
|
|
283
313
|
The error to test.
|
|
284
314
|
|
|
285
|
-
|
|
315
|
+
##### message
|
|
286
316
|
|
|
287
317
|
The message to check for.
|
|
288
318
|
|
|
319
|
+
`string` | `RegExp`
|
|
320
|
+
|
|
289
321
|
#### Returns
|
|
290
322
|
|
|
291
323
|
`error is BaseError`
|
|
@@ -306,11 +338,15 @@ Test to see if any of the errors or children are from a specific class.
|
|
|
306
338
|
|
|
307
339
|
#### Parameters
|
|
308
340
|
|
|
309
|
-
|
|
341
|
+
##### error
|
|
342
|
+
|
|
343
|
+
`unknown`
|
|
310
344
|
|
|
311
345
|
The error to test.
|
|
312
346
|
|
|
313
|
-
|
|
347
|
+
##### cls
|
|
348
|
+
|
|
349
|
+
`string`
|
|
314
350
|
|
|
315
351
|
The class to check for.
|
|
316
352
|
|
|
@@ -334,14 +370,18 @@ Test to see if any of the errors or children have the given error code.
|
|
|
334
370
|
|
|
335
371
|
#### Parameters
|
|
336
372
|
|
|
337
|
-
|
|
373
|
+
##### error
|
|
374
|
+
|
|
375
|
+
`unknown`
|
|
338
376
|
|
|
339
377
|
The error to test.
|
|
340
378
|
|
|
341
|
-
|
|
379
|
+
##### code
|
|
342
380
|
|
|
343
381
|
The code to check for.
|
|
344
382
|
|
|
383
|
+
`string` | `RegExp`
|
|
384
|
+
|
|
345
385
|
#### Returns
|
|
346
386
|
|
|
347
387
|
`error is BaseError`
|
|
@@ -354,12 +394,46 @@ True if the error has the name.
|
|
|
354
394
|
|
|
355
395
|
***
|
|
356
396
|
|
|
397
|
+
### isEmpty()
|
|
398
|
+
|
|
399
|
+
> `static` **isEmpty**(`err`): `boolean`
|
|
400
|
+
|
|
401
|
+
Is the error empty.
|
|
402
|
+
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
##### err
|
|
406
|
+
|
|
407
|
+
[`IError`](../interfaces/IError.md)
|
|
408
|
+
|
|
409
|
+
The error to check for being empty.
|
|
410
|
+
|
|
411
|
+
#### Returns
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
True if the error is empty.
|
|
416
|
+
|
|
417
|
+
#### Inherited from
|
|
418
|
+
|
|
419
|
+
[`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
|
|
420
|
+
|
|
421
|
+
***
|
|
422
|
+
|
|
357
423
|
### toJsonObject()
|
|
358
424
|
|
|
359
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
425
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
360
426
|
|
|
361
427
|
Serialize the error to the error model.
|
|
362
428
|
|
|
429
|
+
#### Parameters
|
|
430
|
+
|
|
431
|
+
##### includeStackTrace?
|
|
432
|
+
|
|
433
|
+
`boolean`
|
|
434
|
+
|
|
435
|
+
Whether to include the error stack in the model, defaults to false.
|
|
436
|
+
|
|
363
437
|
#### Returns
|
|
364
438
|
|
|
365
439
|
[`IError`](../interfaces/IError.md)
|
|
@@ -4,13 +4,13 @@ Class to help with objects.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new ObjectHelper**():
|
|
9
|
+
> **new ObjectHelper**(): `ObjectHelper`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`ObjectHelper`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -22,15 +22,21 @@ Convert an object to bytes.
|
|
|
22
22
|
|
|
23
23
|
#### Type Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### T
|
|
26
|
+
|
|
27
|
+
`T`
|
|
26
28
|
|
|
27
29
|
#### Parameters
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### obj
|
|
30
32
|
|
|
31
33
|
The object to convert.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
`undefined` | `T`
|
|
36
|
+
|
|
37
|
+
##### format
|
|
38
|
+
|
|
39
|
+
`boolean` = `false`
|
|
34
40
|
|
|
35
41
|
Format the JSON content.
|
|
36
42
|
|
|
@@ -50,14 +56,18 @@ Convert a bytes to an object.
|
|
|
50
56
|
|
|
51
57
|
#### Type Parameters
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
##### T
|
|
60
|
+
|
|
61
|
+
`T`
|
|
54
62
|
|
|
55
63
|
#### Parameters
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
##### bytes
|
|
58
66
|
|
|
59
67
|
The bytes to convert to an object.
|
|
60
68
|
|
|
69
|
+
`undefined` | `null` | `Uint8Array`\<`ArrayBufferLike`\>
|
|
70
|
+
|
|
61
71
|
#### Returns
|
|
62
72
|
|
|
63
73
|
`T`
|
|
@@ -78,11 +88,15 @@ Make a deep clone of an object.
|
|
|
78
88
|
|
|
79
89
|
#### Type Parameters
|
|
80
90
|
|
|
81
|
-
|
|
91
|
+
##### T
|
|
92
|
+
|
|
93
|
+
`T`
|
|
82
94
|
|
|
83
95
|
#### Parameters
|
|
84
96
|
|
|
85
|
-
|
|
97
|
+
##### obj
|
|
98
|
+
|
|
99
|
+
`T`
|
|
86
100
|
|
|
87
101
|
The object to clone.
|
|
88
102
|
|
|
@@ -102,17 +116,25 @@ Deep merge objects.
|
|
|
102
116
|
|
|
103
117
|
#### Type Parameters
|
|
104
118
|
|
|
105
|
-
|
|
119
|
+
##### T
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
`T` = `unknown`
|
|
122
|
+
|
|
123
|
+
##### U
|
|
124
|
+
|
|
125
|
+
`U` = `unknown`
|
|
108
126
|
|
|
109
127
|
#### Parameters
|
|
110
128
|
|
|
111
|
-
|
|
129
|
+
##### obj1
|
|
130
|
+
|
|
131
|
+
`T`
|
|
112
132
|
|
|
113
133
|
The first object to merge.
|
|
114
134
|
|
|
115
|
-
|
|
135
|
+
##### obj2
|
|
136
|
+
|
|
137
|
+
`U`
|
|
116
138
|
|
|
117
139
|
The second object to merge.
|
|
118
140
|
|
|
@@ -126,25 +148,33 @@ The combined deep merge of the objects.
|
|
|
126
148
|
|
|
127
149
|
### equal()
|
|
128
150
|
|
|
129
|
-
> `static` **equal**\<`T`\>(`obj1`, `obj2`, `strictPropertyOrder
|
|
151
|
+
> `static` **equal**\<`T`\>(`obj1`, `obj2`, `strictPropertyOrder?`): `boolean`
|
|
130
152
|
|
|
131
153
|
Does one object equal another.
|
|
132
154
|
|
|
133
155
|
#### Type Parameters
|
|
134
156
|
|
|
135
|
-
|
|
157
|
+
##### T
|
|
158
|
+
|
|
159
|
+
`T`
|
|
136
160
|
|
|
137
161
|
#### Parameters
|
|
138
162
|
|
|
139
|
-
|
|
163
|
+
##### obj1
|
|
164
|
+
|
|
165
|
+
`T`
|
|
140
166
|
|
|
141
167
|
The first object to compare.
|
|
142
168
|
|
|
143
|
-
|
|
169
|
+
##### obj2
|
|
170
|
+
|
|
171
|
+
`T`
|
|
144
172
|
|
|
145
173
|
The second object to compare.
|
|
146
174
|
|
|
147
|
-
|
|
175
|
+
##### strictPropertyOrder?
|
|
176
|
+
|
|
177
|
+
`boolean`
|
|
148
178
|
|
|
149
179
|
Should the properties be in the same order, defaults to true.
|
|
150
180
|
|
|
@@ -164,15 +194,21 @@ Get the property of an unknown object.
|
|
|
164
194
|
|
|
165
195
|
#### Type Parameters
|
|
166
196
|
|
|
167
|
-
|
|
197
|
+
##### T
|
|
198
|
+
|
|
199
|
+
`T` = `unknown`
|
|
168
200
|
|
|
169
201
|
#### Parameters
|
|
170
202
|
|
|
171
|
-
|
|
203
|
+
##### obj
|
|
204
|
+
|
|
205
|
+
`unknown`
|
|
172
206
|
|
|
173
207
|
The object to get the property from.
|
|
174
208
|
|
|
175
|
-
|
|
209
|
+
##### property
|
|
210
|
+
|
|
211
|
+
`string`
|
|
176
212
|
|
|
177
213
|
The property to get, can be separated by dots for nested path.
|
|
178
214
|
|
|
@@ -192,15 +228,21 @@ Set the property of an unknown object.
|
|
|
192
228
|
|
|
193
229
|
#### Parameters
|
|
194
230
|
|
|
195
|
-
|
|
231
|
+
##### obj
|
|
232
|
+
|
|
233
|
+
`unknown`
|
|
196
234
|
|
|
197
235
|
The object to set the property from.
|
|
198
236
|
|
|
199
|
-
|
|
237
|
+
##### property
|
|
238
|
+
|
|
239
|
+
`string`
|
|
200
240
|
|
|
201
241
|
The property to set.
|
|
202
242
|
|
|
203
|
-
|
|
243
|
+
##### value
|
|
244
|
+
|
|
245
|
+
`unknown`
|
|
204
246
|
|
|
205
247
|
The value to set.
|
|
206
248
|
|
|
@@ -208,6 +250,10 @@ The value to set.
|
|
|
208
250
|
|
|
209
251
|
`void`
|
|
210
252
|
|
|
253
|
+
#### Throws
|
|
254
|
+
|
|
255
|
+
GeneralError if the property target is not an object.
|
|
256
|
+
|
|
211
257
|
***
|
|
212
258
|
|
|
213
259
|
### propertyDelete()
|
|
@@ -218,11 +264,15 @@ Delete the property of an unknown object.
|
|
|
218
264
|
|
|
219
265
|
#### Parameters
|
|
220
266
|
|
|
221
|
-
|
|
267
|
+
##### obj
|
|
268
|
+
|
|
269
|
+
`unknown`
|
|
222
270
|
|
|
223
271
|
The object to set the property from.
|
|
224
272
|
|
|
225
|
-
|
|
273
|
+
##### property
|
|
274
|
+
|
|
275
|
+
`string`
|
|
226
276
|
|
|
227
277
|
The property to set
|
|
228
278
|
|
|
@@ -240,19 +290,27 @@ Extract a property from the object, providing alternative names.
|
|
|
240
290
|
|
|
241
291
|
#### Type Parameters
|
|
242
292
|
|
|
243
|
-
|
|
293
|
+
##### T
|
|
294
|
+
|
|
295
|
+
`T`
|
|
244
296
|
|
|
245
297
|
#### Parameters
|
|
246
298
|
|
|
247
|
-
|
|
299
|
+
##### obj
|
|
300
|
+
|
|
301
|
+
`unknown`
|
|
248
302
|
|
|
249
303
|
The object to extract from.
|
|
250
304
|
|
|
251
|
-
|
|
305
|
+
##### propertyNames
|
|
252
306
|
|
|
253
307
|
The possible names for the property.
|
|
254
308
|
|
|
255
|
-
|
|
309
|
+
`string` | `string`[]
|
|
310
|
+
|
|
311
|
+
##### removeProperties
|
|
312
|
+
|
|
313
|
+
`boolean` = `true`
|
|
256
314
|
|
|
257
315
|
Remove the properties from the object, defaults to true.
|
|
258
316
|
|
|
@@ -266,21 +324,27 @@ The property if available.
|
|
|
266
324
|
|
|
267
325
|
### pick()
|
|
268
326
|
|
|
269
|
-
> `static` **pick**\<`T`\>(`obj`, `keys
|
|
327
|
+
> `static` **pick**\<`T`\>(`obj`, `keys?`): `Partial`\<`T`\>
|
|
270
328
|
|
|
271
329
|
Pick a subset of properties from an object.
|
|
272
330
|
|
|
273
331
|
#### Type Parameters
|
|
274
332
|
|
|
275
|
-
|
|
333
|
+
##### T
|
|
334
|
+
|
|
335
|
+
`T`
|
|
276
336
|
|
|
277
337
|
#### Parameters
|
|
278
338
|
|
|
279
|
-
|
|
339
|
+
##### obj
|
|
280
340
|
|
|
281
341
|
The object to pick the properties from.
|
|
282
342
|
|
|
283
|
-
|
|
343
|
+
`undefined` | `T`
|
|
344
|
+
|
|
345
|
+
##### keys?
|
|
346
|
+
|
|
347
|
+
keyof `T`[]
|
|
284
348
|
|
|
285
349
|
The property keys to pick.
|
|
286
350
|
|
|
@@ -294,21 +358,27 @@ The partial object.
|
|
|
294
358
|
|
|
295
359
|
### omit()
|
|
296
360
|
|
|
297
|
-
> `static` **omit**\<`T`\>(`obj`, `keys
|
|
361
|
+
> `static` **omit**\<`T`\>(`obj`, `keys?`): `Partial`\<`T`\>
|
|
298
362
|
|
|
299
363
|
Omit a subset of properties from an object.
|
|
300
364
|
|
|
301
365
|
#### Type Parameters
|
|
302
366
|
|
|
303
|
-
|
|
367
|
+
##### T
|
|
368
|
+
|
|
369
|
+
`T`
|
|
304
370
|
|
|
305
371
|
#### Parameters
|
|
306
372
|
|
|
307
|
-
|
|
373
|
+
##### obj
|
|
308
374
|
|
|
309
375
|
The object to omit the properties from.
|
|
310
376
|
|
|
311
|
-
|
|
377
|
+
`undefined` | `T`
|
|
378
|
+
|
|
379
|
+
##### keys?
|
|
380
|
+
|
|
381
|
+
keyof `T`[]
|
|
312
382
|
|
|
313
383
|
The property keys to omit.
|
|
314
384
|
|
|
@@ -317,3 +387,91 @@ The property keys to omit.
|
|
|
317
387
|
`Partial`\<`T`\>
|
|
318
388
|
|
|
319
389
|
The partial object.
|
|
390
|
+
|
|
391
|
+
***
|
|
392
|
+
|
|
393
|
+
### toExtended()
|
|
394
|
+
|
|
395
|
+
> `static` **toExtended**(`obj`): `any`
|
|
396
|
+
|
|
397
|
+
Converter the non JSON primitives to extended types.
|
|
398
|
+
|
|
399
|
+
#### Parameters
|
|
400
|
+
|
|
401
|
+
##### obj
|
|
402
|
+
|
|
403
|
+
`any`
|
|
404
|
+
|
|
405
|
+
The object to convert.
|
|
406
|
+
|
|
407
|
+
#### Returns
|
|
408
|
+
|
|
409
|
+
`any`
|
|
410
|
+
|
|
411
|
+
The object with extended properties.
|
|
412
|
+
|
|
413
|
+
***
|
|
414
|
+
|
|
415
|
+
### fromExtended()
|
|
416
|
+
|
|
417
|
+
> `static` **fromExtended**(`obj`): `any`
|
|
418
|
+
|
|
419
|
+
Converter the extended types to non JSON primitives.
|
|
420
|
+
|
|
421
|
+
#### Parameters
|
|
422
|
+
|
|
423
|
+
##### obj
|
|
424
|
+
|
|
425
|
+
`any`
|
|
426
|
+
|
|
427
|
+
The object to convert.
|
|
428
|
+
|
|
429
|
+
#### Returns
|
|
430
|
+
|
|
431
|
+
`any`
|
|
432
|
+
|
|
433
|
+
The object with regular properties.
|
|
434
|
+
|
|
435
|
+
***
|
|
436
|
+
|
|
437
|
+
### removeEmptyProperties()
|
|
438
|
+
|
|
439
|
+
> `static` **removeEmptyProperties**\<`T`\>(`obj`, `options?`): `T`
|
|
440
|
+
|
|
441
|
+
Remove empty properties from an object.
|
|
442
|
+
|
|
443
|
+
#### Type Parameters
|
|
444
|
+
|
|
445
|
+
##### T
|
|
446
|
+
|
|
447
|
+
`T` = `unknown`
|
|
448
|
+
|
|
449
|
+
#### Parameters
|
|
450
|
+
|
|
451
|
+
##### obj
|
|
452
|
+
|
|
453
|
+
`T`
|
|
454
|
+
|
|
455
|
+
The object to remove the empty properties from.
|
|
456
|
+
|
|
457
|
+
##### options?
|
|
458
|
+
|
|
459
|
+
The options for the removal.
|
|
460
|
+
|
|
461
|
+
###### removeUndefined?
|
|
462
|
+
|
|
463
|
+
`boolean`
|
|
464
|
+
|
|
465
|
+
Remove undefined properties, defaults to true.
|
|
466
|
+
|
|
467
|
+
###### removeNull?
|
|
468
|
+
|
|
469
|
+
`boolean`
|
|
470
|
+
|
|
471
|
+
Remove null properties, defaults to false.
|
|
472
|
+
|
|
473
|
+
#### Returns
|
|
474
|
+
|
|
475
|
+
`T`
|
|
476
|
+
|
|
477
|
+
The object with empty properties removed.
|
|
@@ -4,13 +4,13 @@ Class to help with random generation.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new RandomHelper**():
|
|
9
|
+
> **new RandomHelper**(): `RandomHelper`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`RandomHelper`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -22,7 +22,9 @@ Generate a new random array.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### length
|
|
26
|
+
|
|
27
|
+
`number`
|
|
26
28
|
|
|
27
29
|
The length of buffer to create.
|
|
28
30
|
|