@twin.org/core 0.0.1-next.1

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.
Files changed (103) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +29 -0
  3. package/dist/cjs/index.cjs +4221 -0
  4. package/dist/esm/index.mjs +4184 -0
  5. package/dist/types/encoding/base32.d.ts +18 -0
  6. package/dist/types/encoding/base64.d.ts +24 -0
  7. package/dist/types/encoding/base64Url.d.ts +18 -0
  8. package/dist/types/errors/alreadyExistsError.d.ts +18 -0
  9. package/dist/types/errors/baseError.d.ts +103 -0
  10. package/dist/types/errors/conflictError.d.ts +19 -0
  11. package/dist/types/errors/generalError.d.ts +20 -0
  12. package/dist/types/errors/guardError.d.ts +19 -0
  13. package/dist/types/errors/notFoundError.d.ts +18 -0
  14. package/dist/types/errors/notImplementedError.d.ts +16 -0
  15. package/dist/types/errors/notSupportedError.d.ts +17 -0
  16. package/dist/types/errors/unauthorizedError.d.ts +17 -0
  17. package/dist/types/errors/unprocessableError.d.ts +20 -0
  18. package/dist/types/errors/validationError.d.ts +18 -0
  19. package/dist/types/factories/componentFactory.d.ts +6 -0
  20. package/dist/types/factories/factory.d.ts +67 -0
  21. package/dist/types/helpers/arrayHelper.d.ts +12 -0
  22. package/dist/types/helpers/errorHelper.d.ts +24 -0
  23. package/dist/types/helpers/filenameHelper.d.ts +11 -0
  24. package/dist/types/helpers/hexHelper.d.ts +30 -0
  25. package/dist/types/helpers/jsonHelper.d.ts +29 -0
  26. package/dist/types/helpers/objectHelper.d.ts +74 -0
  27. package/dist/types/helpers/randomHelper.d.ts +11 -0
  28. package/dist/types/helpers/stringHelper.d.ts +90 -0
  29. package/dist/types/index.d.ts +46 -0
  30. package/dist/types/models/IComponent.d.ts +29 -0
  31. package/dist/types/models/IError.d.ts +31 -0
  32. package/dist/types/models/IKeyValue.d.ts +13 -0
  33. package/dist/types/models/ILabelledValue.d.ts +13 -0
  34. package/dist/types/models/ILocale.d.ts +13 -0
  35. package/dist/types/models/ILocaleDictionary.d.ts +6 -0
  36. package/dist/types/models/ILocalesIndex.d.ts +10 -0
  37. package/dist/types/models/IPatchOperation.d.ts +21 -0
  38. package/dist/types/models/IUrlParts.d.ts +29 -0
  39. package/dist/types/models/IValidationFailure.d.ts +23 -0
  40. package/dist/types/models/compressionType.d.ts +17 -0
  41. package/dist/types/types/bitString.d.ts +41 -0
  42. package/dist/types/types/url.d.ts +56 -0
  43. package/dist/types/types/urn.d.ts +93 -0
  44. package/dist/types/utils/asyncCache.d.ts +33 -0
  45. package/dist/types/utils/coerce.d.ts +61 -0
  46. package/dist/types/utils/compression.d.ts +20 -0
  47. package/dist/types/utils/converter.d.ts +85 -0
  48. package/dist/types/utils/guards.d.ts +190 -0
  49. package/dist/types/utils/i18n.d.ts +81 -0
  50. package/dist/types/utils/is.d.ts +205 -0
  51. package/dist/types/utils/validation.d.ts +245 -0
  52. package/docs/changelog.md +5 -0
  53. package/docs/examples.md +1 -0
  54. package/docs/reference/classes/AlreadyExistsError.md +375 -0
  55. package/docs/reference/classes/ArrayHelper.md +37 -0
  56. package/docs/reference/classes/AsyncCache.md +117 -0
  57. package/docs/reference/classes/Base32.md +57 -0
  58. package/docs/reference/classes/Base64.md +74 -0
  59. package/docs/reference/classes/Base64Url.md +54 -0
  60. package/docs/reference/classes/BaseError.md +344 -0
  61. package/docs/reference/classes/BitString.md +123 -0
  62. package/docs/reference/classes/Coerce.md +209 -0
  63. package/docs/reference/classes/Compression.md +61 -0
  64. package/docs/reference/classes/ConflictError.md +379 -0
  65. package/docs/reference/classes/Converter.md +285 -0
  66. package/docs/reference/classes/ErrorHelper.md +73 -0
  67. package/docs/reference/classes/Factory.md +221 -0
  68. package/docs/reference/classes/FilenameHelper.md +33 -0
  69. package/docs/reference/classes/GeneralError.md +375 -0
  70. package/docs/reference/classes/GuardError.md +379 -0
  71. package/docs/reference/classes/Guards.md +711 -0
  72. package/docs/reference/classes/HexHelper.md +97 -0
  73. package/docs/reference/classes/I18n.md +237 -0
  74. package/docs/reference/classes/Is.md +693 -0
  75. package/docs/reference/classes/JsonHelper.md +92 -0
  76. package/docs/reference/classes/NotFoundError.md +375 -0
  77. package/docs/reference/classes/NotImplementedError.md +367 -0
  78. package/docs/reference/classes/NotSupportedError.md +371 -0
  79. package/docs/reference/classes/ObjectHelper.md +287 -0
  80. package/docs/reference/classes/RandomHelper.md +33 -0
  81. package/docs/reference/classes/StringHelper.md +270 -0
  82. package/docs/reference/classes/UnauthorizedError.md +371 -0
  83. package/docs/reference/classes/UnprocessableError.md +375 -0
  84. package/docs/reference/classes/Url.md +167 -0
  85. package/docs/reference/classes/Urn.md +295 -0
  86. package/docs/reference/classes/Validation.md +821 -0
  87. package/docs/reference/classes/ValidationError.md +371 -0
  88. package/docs/reference/index.md +60 -0
  89. package/docs/reference/interfaces/IComponent.md +79 -0
  90. package/docs/reference/interfaces/IError.md +55 -0
  91. package/docs/reference/interfaces/IKeyValue.md +23 -0
  92. package/docs/reference/interfaces/ILabelledValue.md +23 -0
  93. package/docs/reference/interfaces/ILocale.md +19 -0
  94. package/docs/reference/interfaces/ILocaleDictionary.md +7 -0
  95. package/docs/reference/interfaces/ILocalesIndex.md +11 -0
  96. package/docs/reference/interfaces/IPatchOperation.md +35 -0
  97. package/docs/reference/interfaces/IUrlParts.md +51 -0
  98. package/docs/reference/interfaces/IValidationFailure.md +39 -0
  99. package/docs/reference/type-aliases/CompressionType.md +5 -0
  100. package/docs/reference/variables/ComponentFactory.md +5 -0
  101. package/docs/reference/variables/CompressionType.md +19 -0
  102. package/locales/en.json +98 -0
  103. package/package.json +65 -0
@@ -0,0 +1,693 @@
1
+ # Class: Is
2
+
3
+ Class to check types of objects.
4
+
5
+ ## Constructors
6
+
7
+ ### new Is()
8
+
9
+ > **new Is**(): [`Is`](Is.md)
10
+
11
+ #### Returns
12
+
13
+ [`Is`](Is.md)
14
+
15
+ ## Methods
16
+
17
+ ### undefined()
18
+
19
+ > `static` **undefined**(`value`): `value is undefined`
20
+
21
+ Is the property undefined.
22
+
23
+ #### Parameters
24
+
25
+ • **value**: `unknown`
26
+
27
+ The value to test.
28
+
29
+ #### Returns
30
+
31
+ `value is undefined`
32
+
33
+ True if the value is a empty.
34
+
35
+ ***
36
+
37
+ ### null()
38
+
39
+ > `static` **null**(`value`): `value is null`
40
+
41
+ Is the property null.
42
+
43
+ #### Parameters
44
+
45
+ • **value**: `unknown`
46
+
47
+ The value to test.
48
+
49
+ #### Returns
50
+
51
+ `value is null`
52
+
53
+ True if the value is a empty.
54
+
55
+ ***
56
+
57
+ ### empty()
58
+
59
+ > `static` **empty**(`value`): value is undefined \| null
60
+
61
+ Is the property null or undefined.
62
+
63
+ #### Parameters
64
+
65
+ • **value**: `unknown`
66
+
67
+ The value to test.
68
+
69
+ #### Returns
70
+
71
+ value is undefined \| null
72
+
73
+ True if the value is a empty.
74
+
75
+ ***
76
+
77
+ ### notEmpty()
78
+
79
+ > `static` **notEmpty**(`value`): `boolean`
80
+
81
+ Is the property is not null or undefined.
82
+
83
+ #### Parameters
84
+
85
+ • **value**: `unknown`
86
+
87
+ The value to test.
88
+
89
+ #### Returns
90
+
91
+ `boolean`
92
+
93
+ True if the value is a not empty.
94
+
95
+ ***
96
+
97
+ ### string()
98
+
99
+ > `static` **string**(`value`): `value is string`
100
+
101
+ Is the value a string.
102
+
103
+ #### Parameters
104
+
105
+ • **value**: `unknown`
106
+
107
+ The value to test.
108
+
109
+ #### Returns
110
+
111
+ `value is string`
112
+
113
+ True if the value is a string.
114
+
115
+ ***
116
+
117
+ ### stringValue()
118
+
119
+ > `static` **stringValue**(`value`): `value is string`
120
+
121
+ Is the value a string.
122
+
123
+ #### Parameters
124
+
125
+ • **value**: `unknown`
126
+
127
+ The value to test.
128
+
129
+ #### Returns
130
+
131
+ `value is string`
132
+
133
+ True if the value is a string.
134
+
135
+ ***
136
+
137
+ ### json()
138
+
139
+ > `static` **json**(`value`): `value is string`
140
+
141
+ Is the value a JSON string.
142
+
143
+ #### Parameters
144
+
145
+ • **value**: `unknown`
146
+
147
+ The value to test.
148
+
149
+ #### Returns
150
+
151
+ `value is string`
152
+
153
+ True if the value is a JSON string.
154
+
155
+ ***
156
+
157
+ ### stringBase64()
158
+
159
+ > `static` **stringBase64**(`value`): `value is string`
160
+
161
+ Is the value a base64 string.
162
+
163
+ #### Parameters
164
+
165
+ • **value**: `unknown`
166
+
167
+ The value to test.
168
+
169
+ #### Returns
170
+
171
+ `value is string`
172
+
173
+ True if the value is a base64 string.
174
+
175
+ ***
176
+
177
+ ### stringBase64Url()
178
+
179
+ > `static` **stringBase64Url**(`value`): `value is string`
180
+
181
+ Is the value a base64 url string.
182
+
183
+ #### Parameters
184
+
185
+ • **value**: `unknown`
186
+
187
+ The value to test.
188
+
189
+ #### Returns
190
+
191
+ `value is string`
192
+
193
+ True if the value is a base64 string.
194
+
195
+ ***
196
+
197
+ ### stringHex()
198
+
199
+ > `static` **stringHex**(`value`, `allowPrefix`): `value is string`
200
+
201
+ Is the value a hex string.
202
+
203
+ #### Parameters
204
+
205
+ • **value**: `unknown`
206
+
207
+ The value to test.
208
+
209
+ • **allowPrefix**: `boolean` = `false`
210
+
211
+ Allow the hex to have the 0x prefix.
212
+
213
+ #### Returns
214
+
215
+ `value is string`
216
+
217
+ True if the value is a hex string.
218
+
219
+ ***
220
+
221
+ ### stringHexLength()
222
+
223
+ > `static` **stringHexLength**(`value`, `length`, `allowPrefix`): `value is string`
224
+
225
+ Is the value a hex string of fixed length.
226
+
227
+ #### Parameters
228
+
229
+ • **value**: `unknown`
230
+
231
+ The value to test.
232
+
233
+ • **length**: `number`
234
+
235
+ The length to test.
236
+
237
+ • **allowPrefix**: `boolean` = `false`
238
+
239
+ Allow the hex to have the 0x prefix.
240
+
241
+ #### Returns
242
+
243
+ `value is string`
244
+
245
+ True if the value is a hex string of required length.
246
+
247
+ ***
248
+
249
+ ### number()
250
+
251
+ > `static` **number**(`value`): `value is number`
252
+
253
+ Is the value a number.
254
+
255
+ #### Parameters
256
+
257
+ • **value**: `unknown`
258
+
259
+ The value to test.
260
+
261
+ #### Returns
262
+
263
+ `value is number`
264
+
265
+ True if the value is a number.
266
+
267
+ ***
268
+
269
+ ### integer()
270
+
271
+ > `static` **integer**(`value`): `value is number`
272
+
273
+ Is the value an integer.
274
+
275
+ #### Parameters
276
+
277
+ • **value**: `unknown`
278
+
279
+ The value to test.
280
+
281
+ #### Returns
282
+
283
+ `value is number`
284
+
285
+ True if the value is an integer.
286
+
287
+ ***
288
+
289
+ ### bigint()
290
+
291
+ > `static` **bigint**(`value`): `value is bigint`
292
+
293
+ Is the value a big integer.
294
+
295
+ #### Parameters
296
+
297
+ • **value**: `unknown`
298
+
299
+ The value to test.
300
+
301
+ #### Returns
302
+
303
+ `value is bigint`
304
+
305
+ True if the value is a big integer.
306
+
307
+ ***
308
+
309
+ ### boolean()
310
+
311
+ > `static` **boolean**(`value`): `value is boolean`
312
+
313
+ Is the value a boolean.
314
+
315
+ #### Parameters
316
+
317
+ • **value**: `unknown`
318
+
319
+ The value to test.
320
+
321
+ #### Returns
322
+
323
+ `value is boolean`
324
+
325
+ True if the value is a boolean.
326
+
327
+ ***
328
+
329
+ ### date()
330
+
331
+ > `static` **date**(`value`): `value is Date`
332
+
333
+ Is the value a date.
334
+
335
+ #### Parameters
336
+
337
+ • **value**: `unknown`
338
+
339
+ The value to test.
340
+
341
+ #### Returns
342
+
343
+ `value is Date`
344
+
345
+ True if the value is a date.
346
+
347
+ ***
348
+
349
+ ### dateEmpty()
350
+
351
+ > `static` **dateEmpty**(`value`): `boolean`
352
+
353
+ Is the value an empty date.
354
+
355
+ #### Parameters
356
+
357
+ • **value**: `unknown`
358
+
359
+ The value to test.
360
+
361
+ #### Returns
362
+
363
+ `boolean`
364
+
365
+ True if the value is an empty date.
366
+
367
+ ***
368
+
369
+ ### dateString()
370
+
371
+ > `static` **dateString**(`value`): `boolean`
372
+
373
+ Is the value a date string.
374
+
375
+ #### Parameters
376
+
377
+ • **value**: `unknown`
378
+
379
+ The value to test.
380
+
381
+ #### Returns
382
+
383
+ `boolean`
384
+
385
+ True if the value is a string in ISO 8601 date format.
386
+
387
+ ***
388
+
389
+ ### dateTimeString()
390
+
391
+ > `static` **dateTimeString**(`value`): `boolean`
392
+
393
+ Is the value a date string.
394
+
395
+ #### Parameters
396
+
397
+ • **value**: `unknown`
398
+
399
+ The value to test.
400
+
401
+ #### Returns
402
+
403
+ `boolean`
404
+
405
+ True if the value is a string in ISO 8601 date/time format.
406
+
407
+ ***
408
+
409
+ ### timeString()
410
+
411
+ > `static` **timeString**(`value`): `boolean`
412
+
413
+ Is the value a time string.
414
+
415
+ #### Parameters
416
+
417
+ • **value**: `unknown`
418
+
419
+ The value to test.
420
+
421
+ #### Returns
422
+
423
+ `boolean`
424
+
425
+ True if the value is a string in ISO 8601 time format.
426
+
427
+ ***
428
+
429
+ ### timestampSeconds()
430
+
431
+ > `static` **timestampSeconds**(`value`): `value is number`
432
+
433
+ Is the value a timestamp in seconds.
434
+
435
+ #### Parameters
436
+
437
+ • **value**: `unknown`
438
+
439
+ The value to test.
440
+
441
+ #### Returns
442
+
443
+ `value is number`
444
+
445
+ True if the value is a date.
446
+
447
+ ***
448
+
449
+ ### timestampMilliseconds()
450
+
451
+ > `static` **timestampMilliseconds**(`value`): `value is number`
452
+
453
+ Is the value a timestamp in milliseconds.
454
+
455
+ #### Parameters
456
+
457
+ • **value**: `unknown`
458
+
459
+ The value to test.
460
+
461
+ #### Returns
462
+
463
+ `value is number`
464
+
465
+ True if the value is a date.
466
+
467
+ ***
468
+
469
+ ### object()
470
+
471
+ > `static` **object**\<`T`\>(`value`): `value is T`
472
+
473
+ Is the value an object.
474
+
475
+ #### Type Parameters
476
+
477
+ • **T** = `object`
478
+
479
+ #### Parameters
480
+
481
+ • **value**: `unknown`
482
+
483
+ The value to test.
484
+
485
+ #### Returns
486
+
487
+ `value is T`
488
+
489
+ True if the value is a object.
490
+
491
+ ***
492
+
493
+ ### objectValue()
494
+
495
+ > `static` **objectValue**\<`T`\>(`value`): `value is T`
496
+
497
+ Is the value an object with at least one property.
498
+
499
+ #### Type Parameters
500
+
501
+ • **T** = `object`
502
+
503
+ #### Parameters
504
+
505
+ • **value**: `unknown`
506
+
507
+ The value to test.
508
+
509
+ #### Returns
510
+
511
+ `value is T`
512
+
513
+ True if the value is a object.
514
+
515
+ ***
516
+
517
+ ### array()
518
+
519
+ > `static` **array**\<`T`\>(`value`): `value is T[]`
520
+
521
+ Is the value an array.
522
+
523
+ #### Type Parameters
524
+
525
+ • **T**
526
+
527
+ #### Parameters
528
+
529
+ • **value**: `unknown`
530
+
531
+ The value to test.
532
+
533
+ #### Returns
534
+
535
+ `value is T[]`
536
+
537
+ True if the value is an array.
538
+
539
+ ***
540
+
541
+ ### arrayValue()
542
+
543
+ > `static` **arrayValue**\<`T`\>(`value`): `value is T[]`
544
+
545
+ Is the value an array with at least one element.
546
+
547
+ #### Type Parameters
548
+
549
+ • **T**
550
+
551
+ #### Parameters
552
+
553
+ • **value**: `unknown`
554
+
555
+ The value to test.
556
+
557
+ #### Returns
558
+
559
+ `value is T[]`
560
+
561
+ True if the value is an array with at least one element.
562
+
563
+ ***
564
+
565
+ ### arrayOneOf()
566
+
567
+ > `static` **arrayOneOf**\<`T`\>(`value`, `options`): `value is T`
568
+
569
+ Is the value an array with at least one element.
570
+
571
+ #### Type Parameters
572
+
573
+ • **T**
574
+
575
+ #### Parameters
576
+
577
+ • **value**: `T`
578
+
579
+ The value to test.
580
+
581
+ • **options**: `T`[]
582
+
583
+ The options the value must be one of.
584
+
585
+ #### Returns
586
+
587
+ `value is T`
588
+
589
+ True if the value is an element from the options array.
590
+
591
+ ***
592
+
593
+ ### uint8Array()
594
+
595
+ > `static` **uint8Array**(`value`): `value is Uint8Array`
596
+
597
+ Is the value a Uint8Array.
598
+
599
+ #### Parameters
600
+
601
+ • **value**: `unknown`
602
+
603
+ The value to test.
604
+
605
+ #### Returns
606
+
607
+ `value is Uint8Array`
608
+
609
+ True if the value is a Uint8Array.
610
+
611
+ ***
612
+
613
+ ### typedArray()
614
+
615
+ > `static` **typedArray**(`value`): value is Int8Array \| Uint8Array \| Int16Array \| Uint16Array \| Int32Array \| Uint32Array \| Float32Array \| Float64Array
616
+
617
+ Is the value a TypedArray.
618
+
619
+ #### Parameters
620
+
621
+ • **value**: `unknown`
622
+
623
+ The value to test.
624
+
625
+ #### Returns
626
+
627
+ value is Int8Array \| Uint8Array \| Int16Array \| Uint16Array \| Int32Array \| Uint32Array \| Float32Array \| Float64Array
628
+
629
+ True if the value is a TypedArray.
630
+
631
+ ***
632
+
633
+ ### function()
634
+
635
+ > `static` **function**(`value`): `value is Function`
636
+
637
+ Is the property a function.
638
+
639
+ #### Parameters
640
+
641
+ • **value**: `unknown`
642
+
643
+ The value to test.
644
+
645
+ #### Returns
646
+
647
+ `value is Function`
648
+
649
+ True if the value is a function.
650
+
651
+ ***
652
+
653
+ ### email()
654
+
655
+ > `static` **email**(`value`): `value is string`
656
+
657
+ Is the value a string formatted as an email address.
658
+
659
+ #### Parameters
660
+
661
+ • **value**: `unknown`
662
+
663
+ The value to test.
664
+
665
+ #### Returns
666
+
667
+ `value is string`
668
+
669
+ True if the value is a string.
670
+
671
+ ***
672
+
673
+ ### promise()
674
+
675
+ > `static` **promise**\<`T`\>(`value`): `value is Promise<T>`
676
+
677
+ Is the value a promise.
678
+
679
+ #### Type Parameters
680
+
681
+ • **T** = `unknown`
682
+
683
+ #### Parameters
684
+
685
+ • **value**: `unknown`
686
+
687
+ The value to test.
688
+
689
+ #### Returns
690
+
691
+ `value is Promise<T>`
692
+
693
+ True if the value is a promise.