@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
|
@@ -4,13 +4,13 @@ Class to check types of objects.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new Is**():
|
|
9
|
+
> **new Is**(): `Is`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`Is`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -22,7 +22,9 @@ Is the property undefined.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### value
|
|
26
|
+
|
|
27
|
+
`unknown`
|
|
26
28
|
|
|
27
29
|
The value to test.
|
|
28
30
|
|
|
@@ -42,7 +44,9 @@ Is the property null.
|
|
|
42
44
|
|
|
43
45
|
#### Parameters
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
##### value
|
|
48
|
+
|
|
49
|
+
`unknown`
|
|
46
50
|
|
|
47
51
|
The value to test.
|
|
48
52
|
|
|
@@ -62,7 +66,9 @@ Is the property null or undefined.
|
|
|
62
66
|
|
|
63
67
|
#### Parameters
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
##### value
|
|
70
|
+
|
|
71
|
+
`unknown`
|
|
66
72
|
|
|
67
73
|
The value to test.
|
|
68
74
|
|
|
@@ -82,7 +88,9 @@ Is the property is not null or undefined.
|
|
|
82
88
|
|
|
83
89
|
#### Parameters
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
##### value
|
|
92
|
+
|
|
93
|
+
`unknown`
|
|
86
94
|
|
|
87
95
|
The value to test.
|
|
88
96
|
|
|
@@ -102,7 +110,9 @@ Is the value a string.
|
|
|
102
110
|
|
|
103
111
|
#### Parameters
|
|
104
112
|
|
|
105
|
-
|
|
113
|
+
##### value
|
|
114
|
+
|
|
115
|
+
`unknown`
|
|
106
116
|
|
|
107
117
|
The value to test.
|
|
108
118
|
|
|
@@ -122,7 +132,9 @@ Is the value a string.
|
|
|
122
132
|
|
|
123
133
|
#### Parameters
|
|
124
134
|
|
|
125
|
-
|
|
135
|
+
##### value
|
|
136
|
+
|
|
137
|
+
`unknown`
|
|
126
138
|
|
|
127
139
|
The value to test.
|
|
128
140
|
|
|
@@ -142,7 +154,9 @@ Is the value a JSON string.
|
|
|
142
154
|
|
|
143
155
|
#### Parameters
|
|
144
156
|
|
|
145
|
-
|
|
157
|
+
##### value
|
|
158
|
+
|
|
159
|
+
`unknown`
|
|
146
160
|
|
|
147
161
|
The value to test.
|
|
148
162
|
|
|
@@ -162,7 +176,9 @@ Is the value a base64 string.
|
|
|
162
176
|
|
|
163
177
|
#### Parameters
|
|
164
178
|
|
|
165
|
-
|
|
179
|
+
##### value
|
|
180
|
+
|
|
181
|
+
`unknown`
|
|
166
182
|
|
|
167
183
|
The value to test.
|
|
168
184
|
|
|
@@ -182,7 +198,9 @@ Is the value a base64 url string.
|
|
|
182
198
|
|
|
183
199
|
#### Parameters
|
|
184
200
|
|
|
185
|
-
|
|
201
|
+
##### value
|
|
202
|
+
|
|
203
|
+
`unknown`
|
|
186
204
|
|
|
187
205
|
The value to test.
|
|
188
206
|
|
|
@@ -194,6 +212,28 @@ True if the value is a base64 string.
|
|
|
194
212
|
|
|
195
213
|
***
|
|
196
214
|
|
|
215
|
+
### stringBase58()
|
|
216
|
+
|
|
217
|
+
> `static` **stringBase58**(`value`): `value is string`
|
|
218
|
+
|
|
219
|
+
Is the value a base58 string.
|
|
220
|
+
|
|
221
|
+
#### Parameters
|
|
222
|
+
|
|
223
|
+
##### value
|
|
224
|
+
|
|
225
|
+
`unknown`
|
|
226
|
+
|
|
227
|
+
The value to test.
|
|
228
|
+
|
|
229
|
+
#### Returns
|
|
230
|
+
|
|
231
|
+
`value is string`
|
|
232
|
+
|
|
233
|
+
True if the value is a base58 string.
|
|
234
|
+
|
|
235
|
+
***
|
|
236
|
+
|
|
197
237
|
### stringHex()
|
|
198
238
|
|
|
199
239
|
> `static` **stringHex**(`value`, `allowPrefix`): `value is string`
|
|
@@ -202,11 +242,15 @@ Is the value a hex string.
|
|
|
202
242
|
|
|
203
243
|
#### Parameters
|
|
204
244
|
|
|
205
|
-
|
|
245
|
+
##### value
|
|
246
|
+
|
|
247
|
+
`unknown`
|
|
206
248
|
|
|
207
249
|
The value to test.
|
|
208
250
|
|
|
209
|
-
|
|
251
|
+
##### allowPrefix
|
|
252
|
+
|
|
253
|
+
`boolean` = `false`
|
|
210
254
|
|
|
211
255
|
Allow the hex to have the 0x prefix.
|
|
212
256
|
|
|
@@ -226,15 +270,21 @@ Is the value a hex string of fixed length.
|
|
|
226
270
|
|
|
227
271
|
#### Parameters
|
|
228
272
|
|
|
229
|
-
|
|
273
|
+
##### value
|
|
274
|
+
|
|
275
|
+
`unknown`
|
|
230
276
|
|
|
231
277
|
The value to test.
|
|
232
278
|
|
|
233
|
-
|
|
279
|
+
##### length
|
|
280
|
+
|
|
281
|
+
`number`
|
|
234
282
|
|
|
235
283
|
The length to test.
|
|
236
284
|
|
|
237
|
-
|
|
285
|
+
##### allowPrefix
|
|
286
|
+
|
|
287
|
+
`boolean` = `false`
|
|
238
288
|
|
|
239
289
|
Allow the hex to have the 0x prefix.
|
|
240
290
|
|
|
@@ -254,7 +304,9 @@ Is the value a number.
|
|
|
254
304
|
|
|
255
305
|
#### Parameters
|
|
256
306
|
|
|
257
|
-
|
|
307
|
+
##### value
|
|
308
|
+
|
|
309
|
+
`unknown`
|
|
258
310
|
|
|
259
311
|
The value to test.
|
|
260
312
|
|
|
@@ -274,7 +326,9 @@ Is the value an integer.
|
|
|
274
326
|
|
|
275
327
|
#### Parameters
|
|
276
328
|
|
|
277
|
-
|
|
329
|
+
##### value
|
|
330
|
+
|
|
331
|
+
`unknown`
|
|
278
332
|
|
|
279
333
|
The value to test.
|
|
280
334
|
|
|
@@ -294,7 +348,9 @@ Is the value a big integer.
|
|
|
294
348
|
|
|
295
349
|
#### Parameters
|
|
296
350
|
|
|
297
|
-
|
|
351
|
+
##### value
|
|
352
|
+
|
|
353
|
+
`unknown`
|
|
298
354
|
|
|
299
355
|
The value to test.
|
|
300
356
|
|
|
@@ -314,7 +370,9 @@ Is the value a boolean.
|
|
|
314
370
|
|
|
315
371
|
#### Parameters
|
|
316
372
|
|
|
317
|
-
|
|
373
|
+
##### value
|
|
374
|
+
|
|
375
|
+
`unknown`
|
|
318
376
|
|
|
319
377
|
The value to test.
|
|
320
378
|
|
|
@@ -334,7 +392,9 @@ Is the value a date.
|
|
|
334
392
|
|
|
335
393
|
#### Parameters
|
|
336
394
|
|
|
337
|
-
|
|
395
|
+
##### value
|
|
396
|
+
|
|
397
|
+
`unknown`
|
|
338
398
|
|
|
339
399
|
The value to test.
|
|
340
400
|
|
|
@@ -354,7 +414,9 @@ Is the value an empty date.
|
|
|
354
414
|
|
|
355
415
|
#### Parameters
|
|
356
416
|
|
|
357
|
-
|
|
417
|
+
##### value
|
|
418
|
+
|
|
419
|
+
`unknown`
|
|
358
420
|
|
|
359
421
|
The value to test.
|
|
360
422
|
|
|
@@ -374,7 +436,9 @@ Is the value a date string.
|
|
|
374
436
|
|
|
375
437
|
#### Parameters
|
|
376
438
|
|
|
377
|
-
|
|
439
|
+
##### value
|
|
440
|
+
|
|
441
|
+
`unknown`
|
|
378
442
|
|
|
379
443
|
The value to test.
|
|
380
444
|
|
|
@@ -394,7 +458,9 @@ Is the value a date string.
|
|
|
394
458
|
|
|
395
459
|
#### Parameters
|
|
396
460
|
|
|
397
|
-
|
|
461
|
+
##### value
|
|
462
|
+
|
|
463
|
+
`unknown`
|
|
398
464
|
|
|
399
465
|
The value to test.
|
|
400
466
|
|
|
@@ -414,7 +480,9 @@ Is the value a time string.
|
|
|
414
480
|
|
|
415
481
|
#### Parameters
|
|
416
482
|
|
|
417
|
-
|
|
483
|
+
##### value
|
|
484
|
+
|
|
485
|
+
`unknown`
|
|
418
486
|
|
|
419
487
|
The value to test.
|
|
420
488
|
|
|
@@ -434,7 +502,9 @@ Is the value a timestamp in seconds.
|
|
|
434
502
|
|
|
435
503
|
#### Parameters
|
|
436
504
|
|
|
437
|
-
|
|
505
|
+
##### value
|
|
506
|
+
|
|
507
|
+
`unknown`
|
|
438
508
|
|
|
439
509
|
The value to test.
|
|
440
510
|
|
|
@@ -454,7 +524,9 @@ Is the value a timestamp in milliseconds.
|
|
|
454
524
|
|
|
455
525
|
#### Parameters
|
|
456
526
|
|
|
457
|
-
|
|
527
|
+
##### value
|
|
528
|
+
|
|
529
|
+
`unknown`
|
|
458
530
|
|
|
459
531
|
The value to test.
|
|
460
532
|
|
|
@@ -474,11 +546,15 @@ Is the value an object.
|
|
|
474
546
|
|
|
475
547
|
#### Type Parameters
|
|
476
548
|
|
|
477
|
-
|
|
549
|
+
##### T
|
|
550
|
+
|
|
551
|
+
`T` = \{[`id`: `string`]: `unknown`; \}
|
|
478
552
|
|
|
479
553
|
#### Parameters
|
|
480
554
|
|
|
481
|
-
|
|
555
|
+
##### value
|
|
556
|
+
|
|
557
|
+
`unknown`
|
|
482
558
|
|
|
483
559
|
The value to test.
|
|
484
560
|
|
|
@@ -498,11 +574,15 @@ Is the value an object with at least one property.
|
|
|
498
574
|
|
|
499
575
|
#### Type Parameters
|
|
500
576
|
|
|
501
|
-
|
|
577
|
+
##### T
|
|
578
|
+
|
|
579
|
+
`T` = \{[`id`: `string`]: `unknown`; \}
|
|
502
580
|
|
|
503
581
|
#### Parameters
|
|
504
582
|
|
|
505
|
-
|
|
583
|
+
##### value
|
|
584
|
+
|
|
585
|
+
`unknown`
|
|
506
586
|
|
|
507
587
|
The value to test.
|
|
508
588
|
|
|
@@ -522,11 +602,15 @@ Is the value an array.
|
|
|
522
602
|
|
|
523
603
|
#### Type Parameters
|
|
524
604
|
|
|
525
|
-
|
|
605
|
+
##### T
|
|
606
|
+
|
|
607
|
+
`T`
|
|
526
608
|
|
|
527
609
|
#### Parameters
|
|
528
610
|
|
|
529
|
-
|
|
611
|
+
##### value
|
|
612
|
+
|
|
613
|
+
`unknown`
|
|
530
614
|
|
|
531
615
|
The value to test.
|
|
532
616
|
|
|
@@ -546,11 +630,15 @@ Is the value an array with at least one element.
|
|
|
546
630
|
|
|
547
631
|
#### Type Parameters
|
|
548
632
|
|
|
549
|
-
|
|
633
|
+
##### T
|
|
634
|
+
|
|
635
|
+
`T`
|
|
550
636
|
|
|
551
637
|
#### Parameters
|
|
552
638
|
|
|
553
|
-
|
|
639
|
+
##### value
|
|
640
|
+
|
|
641
|
+
`unknown`
|
|
554
642
|
|
|
555
643
|
The value to test.
|
|
556
644
|
|
|
@@ -570,15 +658,21 @@ Is the value an array with at least one element.
|
|
|
570
658
|
|
|
571
659
|
#### Type Parameters
|
|
572
660
|
|
|
573
|
-
|
|
661
|
+
##### T
|
|
662
|
+
|
|
663
|
+
`T`
|
|
574
664
|
|
|
575
665
|
#### Parameters
|
|
576
666
|
|
|
577
|
-
|
|
667
|
+
##### value
|
|
668
|
+
|
|
669
|
+
`T`
|
|
578
670
|
|
|
579
671
|
The value to test.
|
|
580
672
|
|
|
581
|
-
|
|
673
|
+
##### options
|
|
674
|
+
|
|
675
|
+
`T`[]
|
|
582
676
|
|
|
583
677
|
The options the value must be one of.
|
|
584
678
|
|
|
@@ -592,19 +686,21 @@ True if the value is an element from the options array.
|
|
|
592
686
|
|
|
593
687
|
### uint8Array()
|
|
594
688
|
|
|
595
|
-
> `static` **uint8Array**(`value`): `value is Uint8Array
|
|
689
|
+
> `static` **uint8Array**(`value`): `value is Uint8Array<ArrayBufferLike>`
|
|
596
690
|
|
|
597
691
|
Is the value a Uint8Array.
|
|
598
692
|
|
|
599
693
|
#### Parameters
|
|
600
694
|
|
|
601
|
-
|
|
695
|
+
##### value
|
|
696
|
+
|
|
697
|
+
`unknown`
|
|
602
698
|
|
|
603
699
|
The value to test.
|
|
604
700
|
|
|
605
701
|
#### Returns
|
|
606
702
|
|
|
607
|
-
`value is Uint8Array
|
|
703
|
+
`value is Uint8Array<ArrayBufferLike>`
|
|
608
704
|
|
|
609
705
|
True if the value is a Uint8Array.
|
|
610
706
|
|
|
@@ -612,19 +708,21 @@ True if the value is a Uint8Array.
|
|
|
612
708
|
|
|
613
709
|
### typedArray()
|
|
614
710
|
|
|
615
|
-
> `static` **typedArray**(`value`): value is Int8Array \|
|
|
711
|
+
> `static` **typedArray**(`value`): value is Uint8Array\<ArrayBufferLike\> \| Int8Array\<ArrayBufferLike\> \| Uint16Array\<ArrayBufferLike\> \| Int16Array\<ArrayBufferLike\> \| Uint32Array\<ArrayBufferLike\> \| Int32Array\<ArrayBufferLike\> \| Float32Array\<ArrayBufferLike\> \| Float64Array\<ArrayBufferLike\>
|
|
616
712
|
|
|
617
713
|
Is the value a TypedArray.
|
|
618
714
|
|
|
619
715
|
#### Parameters
|
|
620
716
|
|
|
621
|
-
|
|
717
|
+
##### value
|
|
718
|
+
|
|
719
|
+
`unknown`
|
|
622
720
|
|
|
623
721
|
The value to test.
|
|
624
722
|
|
|
625
723
|
#### Returns
|
|
626
724
|
|
|
627
|
-
value is Int8Array \|
|
|
725
|
+
value is Uint8Array\<ArrayBufferLike\> \| Int8Array\<ArrayBufferLike\> \| Uint16Array\<ArrayBufferLike\> \| Int16Array\<ArrayBufferLike\> \| Uint32Array\<ArrayBufferLike\> \| Int32Array\<ArrayBufferLike\> \| Float32Array\<ArrayBufferLike\> \| Float64Array\<ArrayBufferLike\>
|
|
628
726
|
|
|
629
727
|
True if the value is a TypedArray.
|
|
630
728
|
|
|
@@ -632,19 +730,21 @@ True if the value is a TypedArray.
|
|
|
632
730
|
|
|
633
731
|
### function()
|
|
634
732
|
|
|
635
|
-
> `static` **function**(`value`): `value is
|
|
733
|
+
> `static` **function**(`value`): `value is (args: unknown[]) => unknown`
|
|
636
734
|
|
|
637
735
|
Is the property a function.
|
|
638
736
|
|
|
639
737
|
#### Parameters
|
|
640
738
|
|
|
641
|
-
|
|
739
|
+
##### value
|
|
740
|
+
|
|
741
|
+
`unknown`
|
|
642
742
|
|
|
643
743
|
The value to test.
|
|
644
744
|
|
|
645
745
|
#### Returns
|
|
646
746
|
|
|
647
|
-
`value is
|
|
747
|
+
`value is (args: unknown[]) => unknown`
|
|
648
748
|
|
|
649
749
|
True if the value is a function.
|
|
650
750
|
|
|
@@ -658,7 +758,9 @@ Is the value a string formatted as an email address.
|
|
|
658
758
|
|
|
659
759
|
#### Parameters
|
|
660
760
|
|
|
661
|
-
|
|
761
|
+
##### value
|
|
762
|
+
|
|
763
|
+
`unknown`
|
|
662
764
|
|
|
663
765
|
The value to test.
|
|
664
766
|
|
|
@@ -678,11 +780,15 @@ Is the value a promise.
|
|
|
678
780
|
|
|
679
781
|
#### Type Parameters
|
|
680
782
|
|
|
681
|
-
|
|
783
|
+
##### T
|
|
784
|
+
|
|
785
|
+
`T` = `unknown`
|
|
682
786
|
|
|
683
787
|
#### Parameters
|
|
684
788
|
|
|
685
|
-
|
|
789
|
+
##### value
|
|
790
|
+
|
|
791
|
+
`unknown`
|
|
686
792
|
|
|
687
793
|
The value to test.
|
|
688
794
|
|
|
@@ -691,3 +797,25 @@ The value to test.
|
|
|
691
797
|
`value is Promise<T>`
|
|
692
798
|
|
|
693
799
|
True if the value is a promise.
|
|
800
|
+
|
|
801
|
+
***
|
|
802
|
+
|
|
803
|
+
### regexp()
|
|
804
|
+
|
|
805
|
+
> `static` **regexp**(`value`): `value is RegExp`
|
|
806
|
+
|
|
807
|
+
Is the value a regexp.
|
|
808
|
+
|
|
809
|
+
#### Parameters
|
|
810
|
+
|
|
811
|
+
##### value
|
|
812
|
+
|
|
813
|
+
`unknown`
|
|
814
|
+
|
|
815
|
+
The value to test.
|
|
816
|
+
|
|
817
|
+
#### Returns
|
|
818
|
+
|
|
819
|
+
`value is RegExp`
|
|
820
|
+
|
|
821
|
+
True if the value is a regexp.
|
|
@@ -4,13 +4,13 @@ Helpers methods for JSON objects.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new JsonHelper**():
|
|
9
|
+
> **new JsonHelper**(): `JsonHelper`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`JsonHelper`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -23,7 +23,9 @@ Based on https://www.rfc-editor.org/rfc/rfc8785.
|
|
|
23
23
|
|
|
24
24
|
#### Parameters
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
##### object
|
|
27
|
+
|
|
28
|
+
`unknown`
|
|
27
29
|
|
|
28
30
|
The object to be serialized.
|
|
29
31
|
|
|
@@ -44,15 +46,21 @@ Based on https://www.rfc-editor.org/rfc/rfc6902.
|
|
|
44
46
|
|
|
45
47
|
#### Type Parameters
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
##### T
|
|
50
|
+
|
|
51
|
+
`T` = `unknown`
|
|
48
52
|
|
|
49
53
|
#### Parameters
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
##### object1
|
|
56
|
+
|
|
57
|
+
`T`
|
|
52
58
|
|
|
53
59
|
The first object.
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
##### object2
|
|
62
|
+
|
|
63
|
+
`T`
|
|
56
64
|
|
|
57
65
|
The second object.
|
|
58
66
|
|
|
@@ -73,15 +81,21 @@ Based on https://www.rfc-editor.org/rfc/rfc6902.
|
|
|
73
81
|
|
|
74
82
|
#### Type Parameters
|
|
75
83
|
|
|
76
|
-
|
|
84
|
+
##### T
|
|
85
|
+
|
|
86
|
+
`T` = `unknown`
|
|
77
87
|
|
|
78
88
|
#### Parameters
|
|
79
89
|
|
|
80
|
-
|
|
90
|
+
##### object
|
|
91
|
+
|
|
92
|
+
`T`
|
|
81
93
|
|
|
82
94
|
The object to patch.
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
##### patches
|
|
97
|
+
|
|
98
|
+
[`IPatchOperation`](../interfaces/IPatchOperation.md)[]
|
|
85
99
|
|
|
86
100
|
The second object.
|
|
87
101
|
|
|
@@ -90,3 +104,125 @@ The second object.
|
|
|
90
104
|
`T`
|
|
91
105
|
|
|
92
106
|
The updated object.
|
|
107
|
+
|
|
108
|
+
#### Throws
|
|
109
|
+
|
|
110
|
+
GeneralError if the patch fails.
|
|
111
|
+
|
|
112
|
+
***
|
|
113
|
+
|
|
114
|
+
### stringifyEx()
|
|
115
|
+
|
|
116
|
+
> `static` **stringifyEx**(`object`, `space?`): `string`
|
|
117
|
+
|
|
118
|
+
Stringify the JSON with support for extended data types date/bigint/uint8array.
|
|
119
|
+
|
|
120
|
+
#### Parameters
|
|
121
|
+
|
|
122
|
+
##### object
|
|
123
|
+
|
|
124
|
+
`any`
|
|
125
|
+
|
|
126
|
+
The object to stringify.
|
|
127
|
+
|
|
128
|
+
##### space?
|
|
129
|
+
|
|
130
|
+
Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
131
|
+
|
|
132
|
+
`string` | `number`
|
|
133
|
+
|
|
134
|
+
#### Returns
|
|
135
|
+
|
|
136
|
+
`string`
|
|
137
|
+
|
|
138
|
+
The stringified object.
|
|
139
|
+
|
|
140
|
+
***
|
|
141
|
+
|
|
142
|
+
### parseEx()
|
|
143
|
+
|
|
144
|
+
> `static` **parseEx**(`json`): `any`
|
|
145
|
+
|
|
146
|
+
Parse the JSON string with support for extended data types date/bigint/uint8array.
|
|
147
|
+
|
|
148
|
+
#### Parameters
|
|
149
|
+
|
|
150
|
+
##### json
|
|
151
|
+
|
|
152
|
+
`string`
|
|
153
|
+
|
|
154
|
+
The object to pause.
|
|
155
|
+
|
|
156
|
+
#### Returns
|
|
157
|
+
|
|
158
|
+
`any`
|
|
159
|
+
|
|
160
|
+
The object.
|
|
161
|
+
|
|
162
|
+
***
|
|
163
|
+
|
|
164
|
+
### stringifyExReplacer()
|
|
165
|
+
|
|
166
|
+
> `static` **stringifyExReplacer**(`this`, `key`, `value`): `unknown`
|
|
167
|
+
|
|
168
|
+
Replacer function to handle extended data types.
|
|
169
|
+
|
|
170
|
+
#### Parameters
|
|
171
|
+
|
|
172
|
+
##### this
|
|
173
|
+
|
|
174
|
+
`any`
|
|
175
|
+
|
|
176
|
+
The object.
|
|
177
|
+
|
|
178
|
+
##### key
|
|
179
|
+
|
|
180
|
+
`string`
|
|
181
|
+
|
|
182
|
+
The key.
|
|
183
|
+
|
|
184
|
+
##### value
|
|
185
|
+
|
|
186
|
+
`unknown`
|
|
187
|
+
|
|
188
|
+
The value.
|
|
189
|
+
|
|
190
|
+
#### Returns
|
|
191
|
+
|
|
192
|
+
`unknown`
|
|
193
|
+
|
|
194
|
+
The value.
|
|
195
|
+
|
|
196
|
+
***
|
|
197
|
+
|
|
198
|
+
### parseExReviver()
|
|
199
|
+
|
|
200
|
+
> `static` **parseExReviver**(`this`, `key`, `value`): `unknown`
|
|
201
|
+
|
|
202
|
+
Reviver function to handle extended data types.
|
|
203
|
+
|
|
204
|
+
#### Parameters
|
|
205
|
+
|
|
206
|
+
##### this
|
|
207
|
+
|
|
208
|
+
`any`
|
|
209
|
+
|
|
210
|
+
The object.
|
|
211
|
+
|
|
212
|
+
##### key
|
|
213
|
+
|
|
214
|
+
`string`
|
|
215
|
+
|
|
216
|
+
The key.
|
|
217
|
+
|
|
218
|
+
##### value
|
|
219
|
+
|
|
220
|
+
`unknown`
|
|
221
|
+
|
|
222
|
+
The value.
|
|
223
|
+
|
|
224
|
+
#### Returns
|
|
225
|
+
|
|
226
|
+
`unknown`
|
|
227
|
+
|
|
228
|
+
The value.
|