@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,43 +4,49 @@ A class to represent a bit string.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new BitString**(`numberBits`):
|
|
9
|
+
> **new BitString**(`numberBits`): `BitString`
|
|
10
10
|
|
|
11
11
|
Create a new instance of BitString.
|
|
12
12
|
|
|
13
13
|
#### Parameters
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
##### numberBits
|
|
16
|
+
|
|
17
|
+
`number`
|
|
16
18
|
|
|
17
19
|
The length of the bit string.
|
|
18
20
|
|
|
19
21
|
#### Returns
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
`BitString`
|
|
22
24
|
|
|
23
25
|
## Methods
|
|
24
26
|
|
|
25
27
|
### fromBits()
|
|
26
28
|
|
|
27
|
-
> `static` **fromBits**(`bits`, `numberBits`):
|
|
29
|
+
> `static` **fromBits**(`bits`, `numberBits`): `BitString`
|
|
28
30
|
|
|
29
31
|
Create a new instance of BitString from a bit array.
|
|
30
32
|
|
|
31
33
|
#### Parameters
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
##### bits
|
|
36
|
+
|
|
37
|
+
`Uint8Array`
|
|
34
38
|
|
|
35
39
|
The bits to create the bit string from.
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
##### numberBits
|
|
42
|
+
|
|
43
|
+
`number`
|
|
38
44
|
|
|
39
45
|
The number of bits in the bit string.
|
|
40
46
|
|
|
41
47
|
#### Returns
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
`BitString`
|
|
44
50
|
|
|
45
51
|
The new instance of BitString.
|
|
46
52
|
|
|
@@ -54,7 +60,9 @@ Get the bit at the given index.
|
|
|
54
60
|
|
|
55
61
|
#### Parameters
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
##### index
|
|
64
|
+
|
|
65
|
+
`number`
|
|
58
66
|
|
|
59
67
|
The index to get the bit for.
|
|
60
68
|
|
|
@@ -78,11 +86,15 @@ Set the bit at the given index.
|
|
|
78
86
|
|
|
79
87
|
#### Parameters
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
##### index
|
|
90
|
+
|
|
91
|
+
`number`
|
|
82
92
|
|
|
83
93
|
The index to set the bit for.
|
|
84
94
|
|
|
85
|
-
|
|
95
|
+
##### value
|
|
96
|
+
|
|
97
|
+
`boolean`
|
|
86
98
|
|
|
87
99
|
The value to set the bit to.
|
|
88
100
|
|
|
@@ -4,13 +4,13 @@ Coerce an object from one type to another.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new Coerce**():
|
|
9
|
+
> **new Coerce**(): `Coerce`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`Coerce`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -22,7 +22,9 @@ Coerce the value to a string.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### value
|
|
26
|
+
|
|
27
|
+
`unknown`
|
|
26
28
|
|
|
27
29
|
The value to coerce.
|
|
28
30
|
|
|
@@ -46,7 +48,35 @@ Coerce the value to a number.
|
|
|
46
48
|
|
|
47
49
|
#### Parameters
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
##### value
|
|
52
|
+
|
|
53
|
+
`unknown`
|
|
54
|
+
|
|
55
|
+
The value to coerce.
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`undefined` \| `number`
|
|
60
|
+
|
|
61
|
+
The value if it can be coerced.
|
|
62
|
+
|
|
63
|
+
#### Throws
|
|
64
|
+
|
|
65
|
+
TypeError If the value can not be coerced.
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### integer()
|
|
70
|
+
|
|
71
|
+
> `static` **integer**(`value`): `undefined` \| `number`
|
|
72
|
+
|
|
73
|
+
Coerce the value to an integer.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
##### value
|
|
78
|
+
|
|
79
|
+
`unknown`
|
|
50
80
|
|
|
51
81
|
The value to coerce.
|
|
52
82
|
|
|
@@ -70,7 +100,9 @@ Coerce the value to a bigint.
|
|
|
70
100
|
|
|
71
101
|
#### Parameters
|
|
72
102
|
|
|
73
|
-
|
|
103
|
+
##### value
|
|
104
|
+
|
|
105
|
+
`unknown`
|
|
74
106
|
|
|
75
107
|
The value to coerce.
|
|
76
108
|
|
|
@@ -94,7 +126,9 @@ Coerce the value to a boolean.
|
|
|
94
126
|
|
|
95
127
|
#### Parameters
|
|
96
128
|
|
|
97
|
-
|
|
129
|
+
##### value
|
|
130
|
+
|
|
131
|
+
`unknown`
|
|
98
132
|
|
|
99
133
|
The value to coerce.
|
|
100
134
|
|
|
@@ -118,7 +152,9 @@ Coerce the value to a date.
|
|
|
118
152
|
|
|
119
153
|
#### Parameters
|
|
120
154
|
|
|
121
|
-
|
|
155
|
+
##### value
|
|
156
|
+
|
|
157
|
+
`unknown`
|
|
122
158
|
|
|
123
159
|
The value to coerce.
|
|
124
160
|
|
|
@@ -142,7 +178,9 @@ Coerce the value to a date/time.
|
|
|
142
178
|
|
|
143
179
|
#### Parameters
|
|
144
180
|
|
|
145
|
-
|
|
181
|
+
##### value
|
|
182
|
+
|
|
183
|
+
`unknown`
|
|
146
184
|
|
|
147
185
|
The value to coerce.
|
|
148
186
|
|
|
@@ -166,7 +204,9 @@ Coerce the value to a time.
|
|
|
166
204
|
|
|
167
205
|
#### Parameters
|
|
168
206
|
|
|
169
|
-
|
|
207
|
+
##### value
|
|
208
|
+
|
|
209
|
+
`unknown`
|
|
170
210
|
|
|
171
211
|
The value to coerce.
|
|
172
212
|
|
|
@@ -190,11 +230,15 @@ Coerce the value to an object.
|
|
|
190
230
|
|
|
191
231
|
#### Type Parameters
|
|
192
232
|
|
|
193
|
-
|
|
233
|
+
##### T
|
|
234
|
+
|
|
235
|
+
`T` = `unknown`
|
|
194
236
|
|
|
195
237
|
#### Parameters
|
|
196
238
|
|
|
197
|
-
|
|
239
|
+
##### value
|
|
240
|
+
|
|
241
|
+
`unknown`
|
|
198
242
|
|
|
199
243
|
The value to coerce.
|
|
200
244
|
|
|
@@ -207,3 +251,57 @@ The value if it can be coerced.
|
|
|
207
251
|
#### Throws
|
|
208
252
|
|
|
209
253
|
TypeError If the value can not be coerced.
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
### uint8Array()
|
|
258
|
+
|
|
259
|
+
> `static` **uint8Array**(`value`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
260
|
+
|
|
261
|
+
Coerce the value to a Uint8Array.
|
|
262
|
+
|
|
263
|
+
#### Parameters
|
|
264
|
+
|
|
265
|
+
##### value
|
|
266
|
+
|
|
267
|
+
`unknown`
|
|
268
|
+
|
|
269
|
+
The value to coerce.
|
|
270
|
+
|
|
271
|
+
#### Returns
|
|
272
|
+
|
|
273
|
+
`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
274
|
+
|
|
275
|
+
The value if it can be coerced.
|
|
276
|
+
|
|
277
|
+
#### Throws
|
|
278
|
+
|
|
279
|
+
TypeError If the value can not be coerced.
|
|
280
|
+
|
|
281
|
+
***
|
|
282
|
+
|
|
283
|
+
### byType()
|
|
284
|
+
|
|
285
|
+
> `static` **byType**(`value`, `type?`): `unknown`
|
|
286
|
+
|
|
287
|
+
Coerces a value based on the coercion type.
|
|
288
|
+
|
|
289
|
+
#### Parameters
|
|
290
|
+
|
|
291
|
+
##### value
|
|
292
|
+
|
|
293
|
+
`unknown`
|
|
294
|
+
|
|
295
|
+
The value to coerce.
|
|
296
|
+
|
|
297
|
+
##### type?
|
|
298
|
+
|
|
299
|
+
[`CoerceType`](../type-aliases/CoerceType.md)
|
|
300
|
+
|
|
301
|
+
The coercion type to perform.
|
|
302
|
+
|
|
303
|
+
#### Returns
|
|
304
|
+
|
|
305
|
+
`unknown`
|
|
306
|
+
|
|
307
|
+
The coerced value.
|
|
@@ -4,35 +4,39 @@ A class to handle compression.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new Compression**():
|
|
9
|
+
> **new Compression**(): `Compression`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`Compression`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
17
|
### compress()
|
|
18
18
|
|
|
19
|
-
> `static` **compress**(`bytes`, `type`): `Promise`\<`Uint8Array
|
|
19
|
+
> `static` **compress**(`bytes`, `type`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
20
20
|
|
|
21
21
|
Compress bytes using GZIP.
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### bytes
|
|
26
|
+
|
|
27
|
+
`Uint8Array`
|
|
26
28
|
|
|
27
29
|
The bytes to compress.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### type
|
|
32
|
+
|
|
33
|
+
[`CompressionType`](../type-aliases/CompressionType.md)
|
|
30
34
|
|
|
31
35
|
The type of compression to use.
|
|
32
36
|
|
|
33
37
|
#### Returns
|
|
34
38
|
|
|
35
|
-
`Promise`\<`Uint8Array
|
|
39
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
36
40
|
|
|
37
41
|
The compressed bytes.
|
|
38
42
|
|
|
@@ -40,22 +44,26 @@ The compressed bytes.
|
|
|
40
44
|
|
|
41
45
|
### decompress()
|
|
42
46
|
|
|
43
|
-
> `static` **decompress**(`compressedBytes`, `type`): `Promise`\<`Uint8Array
|
|
47
|
+
> `static` **decompress**(`compressedBytes`, `type`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
44
48
|
|
|
45
49
|
Decompress a gzipped compressed byte array.
|
|
46
50
|
|
|
47
51
|
#### Parameters
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
##### compressedBytes
|
|
54
|
+
|
|
55
|
+
`Uint8Array`
|
|
50
56
|
|
|
51
57
|
The compressed bytes.
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
##### type
|
|
60
|
+
|
|
61
|
+
[`CompressionType`](../type-aliases/CompressionType.md)
|
|
54
62
|
|
|
55
63
|
The type of compression to use.
|
|
56
64
|
|
|
57
65
|
#### Returns
|
|
58
66
|
|
|
59
|
-
`Promise`\<`Uint8Array
|
|
67
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
60
68
|
|
|
61
69
|
The decompressed bytes.
|
|
@@ -8,41 +8,51 @@ Class to handle errors which are triggered by conflicting data.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new ConflictError**(`source`, `message`, `conflictId
|
|
13
|
+
> **new ConflictError**(`source`, `message`, `conflictId?`, `conflicts?`, `inner?`): `ConflictError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of ConflictError.
|
|
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
|
+
##### conflictId?
|
|
32
|
+
|
|
33
|
+
`string`
|
|
28
34
|
|
|
29
35
|
The id that has conflicts.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
##### conflicts?
|
|
38
|
+
|
|
39
|
+
`string`[]
|
|
32
40
|
|
|
33
41
|
The conflicts that occurred.
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
##### inner?
|
|
44
|
+
|
|
45
|
+
`unknown`
|
|
36
46
|
|
|
37
47
|
The inner error if we have wrapped another error.
|
|
38
48
|
|
|
39
49
|
#### Returns
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
`ConflictError`
|
|
42
52
|
|
|
43
53
|
#### Overrides
|
|
44
54
|
|
|
45
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
55
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
46
56
|
|
|
47
57
|
## Properties
|
|
48
58
|
|
|
@@ -66,7 +76,7 @@ Any additional information for the error.
|
|
|
66
76
|
|
|
67
77
|
#### Index Signature
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
\[`id`: `string`\]: `unknown`
|
|
70
80
|
|
|
71
81
|
#### Inherited from
|
|
72
82
|
|
|
@@ -102,7 +112,9 @@ Construct an error from an existing one.
|
|
|
102
112
|
|
|
103
113
|
#### Parameters
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
##### err
|
|
116
|
+
|
|
117
|
+
`unknown`
|
|
106
118
|
|
|
107
119
|
The existing error.
|
|
108
120
|
|
|
@@ -126,7 +138,9 @@ Flatten an error tree.
|
|
|
126
138
|
|
|
127
139
|
#### Parameters
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
##### err
|
|
142
|
+
|
|
143
|
+
`unknown`
|
|
130
144
|
|
|
131
145
|
The starting error.
|
|
132
146
|
|
|
@@ -150,10 +164,12 @@ Expand an error tree.
|
|
|
150
164
|
|
|
151
165
|
#### Parameters
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
##### errors
|
|
154
168
|
|
|
155
169
|
The list of errors to expand.
|
|
156
170
|
|
|
171
|
+
`undefined` | [`IError`](../interfaces/IError.md)[]
|
|
172
|
+
|
|
157
173
|
#### Returns
|
|
158
174
|
|
|
159
175
|
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
@@ -174,14 +190,18 @@ Test to see if the error has the specified error name.
|
|
|
174
190
|
|
|
175
191
|
#### Parameters
|
|
176
192
|
|
|
177
|
-
|
|
193
|
+
##### error
|
|
194
|
+
|
|
195
|
+
`unknown`
|
|
178
196
|
|
|
179
197
|
The error to test.
|
|
180
198
|
|
|
181
|
-
|
|
199
|
+
##### name
|
|
182
200
|
|
|
183
201
|
The name to check for.
|
|
184
202
|
|
|
203
|
+
`string` | `RegExp`
|
|
204
|
+
|
|
185
205
|
#### Returns
|
|
186
206
|
|
|
187
207
|
`error is BaseError`
|
|
@@ -202,14 +222,18 @@ Test to see if the error has the specified error message.
|
|
|
202
222
|
|
|
203
223
|
#### Parameters
|
|
204
224
|
|
|
205
|
-
|
|
225
|
+
##### error
|
|
226
|
+
|
|
227
|
+
`unknown`
|
|
206
228
|
|
|
207
229
|
The error to test.
|
|
208
230
|
|
|
209
|
-
|
|
231
|
+
##### message
|
|
210
232
|
|
|
211
233
|
The message to check for.
|
|
212
234
|
|
|
235
|
+
`string` | `RegExp`
|
|
236
|
+
|
|
213
237
|
#### Returns
|
|
214
238
|
|
|
215
239
|
`error is BaseError`
|
|
@@ -230,14 +254,18 @@ Test to see if the error has the specified error code.
|
|
|
230
254
|
|
|
231
255
|
#### Parameters
|
|
232
256
|
|
|
233
|
-
|
|
257
|
+
##### error
|
|
258
|
+
|
|
259
|
+
`unknown`
|
|
234
260
|
|
|
235
261
|
The error to test.
|
|
236
262
|
|
|
237
|
-
|
|
263
|
+
##### code
|
|
238
264
|
|
|
239
265
|
The code to check for.
|
|
240
266
|
|
|
267
|
+
`string` | `RegExp`
|
|
268
|
+
|
|
241
269
|
#### Returns
|
|
242
270
|
|
|
243
271
|
`boolean`
|
|
@@ -258,14 +286,18 @@ Test to see if any of the errors or children have the given error name.
|
|
|
258
286
|
|
|
259
287
|
#### Parameters
|
|
260
288
|
|
|
261
|
-
|
|
289
|
+
##### error
|
|
290
|
+
|
|
291
|
+
`unknown`
|
|
262
292
|
|
|
263
293
|
The error to test.
|
|
264
294
|
|
|
265
|
-
|
|
295
|
+
##### name
|
|
266
296
|
|
|
267
297
|
The name to check for.
|
|
268
298
|
|
|
299
|
+
`string` | `RegExp`
|
|
300
|
+
|
|
269
301
|
#### Returns
|
|
270
302
|
|
|
271
303
|
`error is BaseError`
|
|
@@ -286,14 +318,18 @@ Test to see if any of the errors or children have the given error message.
|
|
|
286
318
|
|
|
287
319
|
#### Parameters
|
|
288
320
|
|
|
289
|
-
|
|
321
|
+
##### error
|
|
322
|
+
|
|
323
|
+
`unknown`
|
|
290
324
|
|
|
291
325
|
The error to test.
|
|
292
326
|
|
|
293
|
-
|
|
327
|
+
##### message
|
|
294
328
|
|
|
295
329
|
The message to check for.
|
|
296
330
|
|
|
331
|
+
`string` | `RegExp`
|
|
332
|
+
|
|
297
333
|
#### Returns
|
|
298
334
|
|
|
299
335
|
`error is BaseError`
|
|
@@ -314,11 +350,15 @@ Test to see if any of the errors or children are from a specific class.
|
|
|
314
350
|
|
|
315
351
|
#### Parameters
|
|
316
352
|
|
|
317
|
-
|
|
353
|
+
##### error
|
|
354
|
+
|
|
355
|
+
`unknown`
|
|
318
356
|
|
|
319
357
|
The error to test.
|
|
320
358
|
|
|
321
|
-
|
|
359
|
+
##### cls
|
|
360
|
+
|
|
361
|
+
`string`
|
|
322
362
|
|
|
323
363
|
The class to check for.
|
|
324
364
|
|
|
@@ -342,14 +382,18 @@ Test to see if any of the errors or children have the given error code.
|
|
|
342
382
|
|
|
343
383
|
#### Parameters
|
|
344
384
|
|
|
345
|
-
|
|
385
|
+
##### error
|
|
386
|
+
|
|
387
|
+
`unknown`
|
|
346
388
|
|
|
347
389
|
The error to test.
|
|
348
390
|
|
|
349
|
-
|
|
391
|
+
##### code
|
|
350
392
|
|
|
351
393
|
The code to check for.
|
|
352
394
|
|
|
395
|
+
`string` | `RegExp`
|
|
396
|
+
|
|
353
397
|
#### Returns
|
|
354
398
|
|
|
355
399
|
`error is BaseError`
|
|
@@ -362,12 +406,46 @@ True if the error has the name.
|
|
|
362
406
|
|
|
363
407
|
***
|
|
364
408
|
|
|
409
|
+
### isEmpty()
|
|
410
|
+
|
|
411
|
+
> `static` **isEmpty**(`err`): `boolean`
|
|
412
|
+
|
|
413
|
+
Is the error empty.
|
|
414
|
+
|
|
415
|
+
#### Parameters
|
|
416
|
+
|
|
417
|
+
##### err
|
|
418
|
+
|
|
419
|
+
[`IError`](../interfaces/IError.md)
|
|
420
|
+
|
|
421
|
+
The error to check for being empty.
|
|
422
|
+
|
|
423
|
+
#### Returns
|
|
424
|
+
|
|
425
|
+
`boolean`
|
|
426
|
+
|
|
427
|
+
True if the error is empty.
|
|
428
|
+
|
|
429
|
+
#### Inherited from
|
|
430
|
+
|
|
431
|
+
[`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
|
|
432
|
+
|
|
433
|
+
***
|
|
434
|
+
|
|
365
435
|
### toJsonObject()
|
|
366
436
|
|
|
367
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
437
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
368
438
|
|
|
369
439
|
Serialize the error to the error model.
|
|
370
440
|
|
|
441
|
+
#### Parameters
|
|
442
|
+
|
|
443
|
+
##### includeStackTrace?
|
|
444
|
+
|
|
445
|
+
`boolean`
|
|
446
|
+
|
|
447
|
+
Whether to include the error stack in the model, defaults to false.
|
|
448
|
+
|
|
371
449
|
#### Returns
|
|
372
450
|
|
|
373
451
|
[`IError`](../interfaces/IError.md)
|