@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.
- package/LICENSE +201 -0
- package/README.md +29 -0
- package/dist/cjs/index.cjs +4221 -0
- package/dist/esm/index.mjs +4184 -0
- package/dist/types/encoding/base32.d.ts +18 -0
- package/dist/types/encoding/base64.d.ts +24 -0
- package/dist/types/encoding/base64Url.d.ts +18 -0
- package/dist/types/errors/alreadyExistsError.d.ts +18 -0
- package/dist/types/errors/baseError.d.ts +103 -0
- package/dist/types/errors/conflictError.d.ts +19 -0
- package/dist/types/errors/generalError.d.ts +20 -0
- package/dist/types/errors/guardError.d.ts +19 -0
- package/dist/types/errors/notFoundError.d.ts +18 -0
- package/dist/types/errors/notImplementedError.d.ts +16 -0
- package/dist/types/errors/notSupportedError.d.ts +17 -0
- package/dist/types/errors/unauthorizedError.d.ts +17 -0
- package/dist/types/errors/unprocessableError.d.ts +20 -0
- package/dist/types/errors/validationError.d.ts +18 -0
- package/dist/types/factories/componentFactory.d.ts +6 -0
- package/dist/types/factories/factory.d.ts +67 -0
- package/dist/types/helpers/arrayHelper.d.ts +12 -0
- package/dist/types/helpers/errorHelper.d.ts +24 -0
- package/dist/types/helpers/filenameHelper.d.ts +11 -0
- package/dist/types/helpers/hexHelper.d.ts +30 -0
- package/dist/types/helpers/jsonHelper.d.ts +29 -0
- package/dist/types/helpers/objectHelper.d.ts +74 -0
- package/dist/types/helpers/randomHelper.d.ts +11 -0
- package/dist/types/helpers/stringHelper.d.ts +90 -0
- package/dist/types/index.d.ts +46 -0
- package/dist/types/models/IComponent.d.ts +29 -0
- package/dist/types/models/IError.d.ts +31 -0
- package/dist/types/models/IKeyValue.d.ts +13 -0
- package/dist/types/models/ILabelledValue.d.ts +13 -0
- package/dist/types/models/ILocale.d.ts +13 -0
- package/dist/types/models/ILocaleDictionary.d.ts +6 -0
- package/dist/types/models/ILocalesIndex.d.ts +10 -0
- package/dist/types/models/IPatchOperation.d.ts +21 -0
- package/dist/types/models/IUrlParts.d.ts +29 -0
- package/dist/types/models/IValidationFailure.d.ts +23 -0
- package/dist/types/models/compressionType.d.ts +17 -0
- package/dist/types/types/bitString.d.ts +41 -0
- package/dist/types/types/url.d.ts +56 -0
- package/dist/types/types/urn.d.ts +93 -0
- package/dist/types/utils/asyncCache.d.ts +33 -0
- package/dist/types/utils/coerce.d.ts +61 -0
- package/dist/types/utils/compression.d.ts +20 -0
- package/dist/types/utils/converter.d.ts +85 -0
- package/dist/types/utils/guards.d.ts +190 -0
- package/dist/types/utils/i18n.d.ts +81 -0
- package/dist/types/utils/is.d.ts +205 -0
- package/dist/types/utils/validation.d.ts +245 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/AlreadyExistsError.md +375 -0
- package/docs/reference/classes/ArrayHelper.md +37 -0
- package/docs/reference/classes/AsyncCache.md +117 -0
- package/docs/reference/classes/Base32.md +57 -0
- package/docs/reference/classes/Base64.md +74 -0
- package/docs/reference/classes/Base64Url.md +54 -0
- package/docs/reference/classes/BaseError.md +344 -0
- package/docs/reference/classes/BitString.md +123 -0
- package/docs/reference/classes/Coerce.md +209 -0
- package/docs/reference/classes/Compression.md +61 -0
- package/docs/reference/classes/ConflictError.md +379 -0
- package/docs/reference/classes/Converter.md +285 -0
- package/docs/reference/classes/ErrorHelper.md +73 -0
- package/docs/reference/classes/Factory.md +221 -0
- package/docs/reference/classes/FilenameHelper.md +33 -0
- package/docs/reference/classes/GeneralError.md +375 -0
- package/docs/reference/classes/GuardError.md +379 -0
- package/docs/reference/classes/Guards.md +711 -0
- package/docs/reference/classes/HexHelper.md +97 -0
- package/docs/reference/classes/I18n.md +237 -0
- package/docs/reference/classes/Is.md +693 -0
- package/docs/reference/classes/JsonHelper.md +92 -0
- package/docs/reference/classes/NotFoundError.md +375 -0
- package/docs/reference/classes/NotImplementedError.md +367 -0
- package/docs/reference/classes/NotSupportedError.md +371 -0
- package/docs/reference/classes/ObjectHelper.md +287 -0
- package/docs/reference/classes/RandomHelper.md +33 -0
- package/docs/reference/classes/StringHelper.md +270 -0
- package/docs/reference/classes/UnauthorizedError.md +371 -0
- package/docs/reference/classes/UnprocessableError.md +375 -0
- package/docs/reference/classes/Url.md +167 -0
- package/docs/reference/classes/Urn.md +295 -0
- package/docs/reference/classes/Validation.md +821 -0
- package/docs/reference/classes/ValidationError.md +371 -0
- package/docs/reference/index.md +60 -0
- package/docs/reference/interfaces/IComponent.md +79 -0
- package/docs/reference/interfaces/IError.md +55 -0
- package/docs/reference/interfaces/IKeyValue.md +23 -0
- package/docs/reference/interfaces/ILabelledValue.md +23 -0
- package/docs/reference/interfaces/ILocale.md +19 -0
- package/docs/reference/interfaces/ILocaleDictionary.md +7 -0
- package/docs/reference/interfaces/ILocalesIndex.md +11 -0
- package/docs/reference/interfaces/IPatchOperation.md +35 -0
- package/docs/reference/interfaces/IUrlParts.md +51 -0
- package/docs/reference/interfaces/IValidationFailure.md +39 -0
- package/docs/reference/type-aliases/CompressionType.md +5 -0
- package/docs/reference/variables/ComponentFactory.md +5 -0
- package/docs/reference/variables/CompressionType.md +19 -0
- package/locales/en.json +98 -0
- package/package.json +65 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Class: AsyncCache
|
|
2
|
+
|
|
3
|
+
Cache the results from asynchronous requests.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new AsyncCache()
|
|
8
|
+
|
|
9
|
+
> **new AsyncCache**(): [`AsyncCache`](AsyncCache.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`AsyncCache`](AsyncCache.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### exec()
|
|
18
|
+
|
|
19
|
+
> `static` **exec**\<`T`\>(`key`, `ttlMs`, `requestMethod`): `undefined` \| `Promise`\<`T`\>
|
|
20
|
+
|
|
21
|
+
Execute an async request and cache the result.
|
|
22
|
+
|
|
23
|
+
#### Type Parameters
|
|
24
|
+
|
|
25
|
+
• **T** = `unknown`
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **key**: `string`
|
|
30
|
+
|
|
31
|
+
The key for the entry in the cache.
|
|
32
|
+
|
|
33
|
+
• **ttlMs**: `undefined` \| `number`
|
|
34
|
+
|
|
35
|
+
The TTL of the entry in the cache.
|
|
36
|
+
|
|
37
|
+
• **requestMethod**
|
|
38
|
+
|
|
39
|
+
The method to call if not cached.
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
`undefined` \| `Promise`\<`T`\>
|
|
44
|
+
|
|
45
|
+
The response.
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### get()
|
|
50
|
+
|
|
51
|
+
> `static` **get**\<`T`\>(`key`): `Promise`\<`undefined` \| `T`\>
|
|
52
|
+
|
|
53
|
+
Get an entry from the cache.
|
|
54
|
+
|
|
55
|
+
#### Type Parameters
|
|
56
|
+
|
|
57
|
+
• **T** = `unknown`
|
|
58
|
+
|
|
59
|
+
#### Parameters
|
|
60
|
+
|
|
61
|
+
• **key**: `string`
|
|
62
|
+
|
|
63
|
+
The key to get from the cache.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`Promise`\<`undefined` \| `T`\>
|
|
68
|
+
|
|
69
|
+
The item from the cache if it exists.
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
### remove()
|
|
74
|
+
|
|
75
|
+
> `static` **remove**(`key`): `void`
|
|
76
|
+
|
|
77
|
+
Remove an entry from the cache.
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
• **key**: `string`
|
|
82
|
+
|
|
83
|
+
The key to remove from the cache.
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`void`
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### clearCache()
|
|
92
|
+
|
|
93
|
+
> `static` **clearCache**(`prefix`?): `void`
|
|
94
|
+
|
|
95
|
+
Clear the cache.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
• **prefix?**: `string`
|
|
100
|
+
|
|
101
|
+
Optional prefix to clear only entries with that prefix.
|
|
102
|
+
|
|
103
|
+
#### Returns
|
|
104
|
+
|
|
105
|
+
`void`
|
|
106
|
+
|
|
107
|
+
***
|
|
108
|
+
|
|
109
|
+
### cleanupExpired()
|
|
110
|
+
|
|
111
|
+
> `static` **cleanupExpired**(): `void`
|
|
112
|
+
|
|
113
|
+
Perform a cleanup of the expired entries in the cache.
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`void`
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Class: Base32
|
|
2
|
+
|
|
3
|
+
Class to help with base63 Encoding/Decoding.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new Base32()
|
|
8
|
+
|
|
9
|
+
> **new Base32**(): [`Base32`](Base32.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`Base32`](Base32.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### decode()
|
|
18
|
+
|
|
19
|
+
> `static` **decode**(`base32`): `Uint8Array`
|
|
20
|
+
|
|
21
|
+
Convert the base 32 string to a byte array.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **base32**: `string`
|
|
26
|
+
|
|
27
|
+
The base32 string to convert.
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
`Uint8Array`
|
|
32
|
+
|
|
33
|
+
The byte array.
|
|
34
|
+
|
|
35
|
+
#### Throws
|
|
36
|
+
|
|
37
|
+
If the input string contains a character not in the Base32 alphabet.
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### encode()
|
|
42
|
+
|
|
43
|
+
> `static` **encode**(`bytes`): `string`
|
|
44
|
+
|
|
45
|
+
Convert a byte array to base 32.
|
|
46
|
+
|
|
47
|
+
#### Parameters
|
|
48
|
+
|
|
49
|
+
• **bytes**: `Uint8Array`
|
|
50
|
+
|
|
51
|
+
The byte array to convert.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The data as base32 string.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Class: Base64
|
|
2
|
+
|
|
3
|
+
Class to help with base64 Encoding/Decoding.
|
|
4
|
+
Sourced from https://github.com/beatgammit/base64-js.
|
|
5
|
+
|
|
6
|
+
## Constructors
|
|
7
|
+
|
|
8
|
+
### new Base64()
|
|
9
|
+
|
|
10
|
+
> **new Base64**(): [`Base64`](Base64.md)
|
|
11
|
+
|
|
12
|
+
#### Returns
|
|
13
|
+
|
|
14
|
+
[`Base64`](Base64.md)
|
|
15
|
+
|
|
16
|
+
## Methods
|
|
17
|
+
|
|
18
|
+
### byteLength()
|
|
19
|
+
|
|
20
|
+
> `static` **byteLength**(`base64`): `number`
|
|
21
|
+
|
|
22
|
+
Get the byte length of the data.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
• **base64**: `string`
|
|
27
|
+
|
|
28
|
+
The base64 string.
|
|
29
|
+
|
|
30
|
+
#### Returns
|
|
31
|
+
|
|
32
|
+
`number`
|
|
33
|
+
|
|
34
|
+
The byte length of the data.
|
|
35
|
+
|
|
36
|
+
***
|
|
37
|
+
|
|
38
|
+
### decode()
|
|
39
|
+
|
|
40
|
+
> `static` **decode**(`base64`): `Uint8Array`
|
|
41
|
+
|
|
42
|
+
Convert the base 64 string to a byte array.
|
|
43
|
+
|
|
44
|
+
#### Parameters
|
|
45
|
+
|
|
46
|
+
• **base64**: `string`
|
|
47
|
+
|
|
48
|
+
The base64 string to convert.
|
|
49
|
+
|
|
50
|
+
#### Returns
|
|
51
|
+
|
|
52
|
+
`Uint8Array`
|
|
53
|
+
|
|
54
|
+
The byte array.
|
|
55
|
+
|
|
56
|
+
***
|
|
57
|
+
|
|
58
|
+
### encode()
|
|
59
|
+
|
|
60
|
+
> `static` **encode**(`bytes`): `string`
|
|
61
|
+
|
|
62
|
+
Convert a byte array to base 64.
|
|
63
|
+
|
|
64
|
+
#### Parameters
|
|
65
|
+
|
|
66
|
+
• **bytes**: `Uint8Array`
|
|
67
|
+
|
|
68
|
+
The byte array to convert.
|
|
69
|
+
|
|
70
|
+
#### Returns
|
|
71
|
+
|
|
72
|
+
`string`
|
|
73
|
+
|
|
74
|
+
The data as base64 string.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Class: Base64Url
|
|
2
|
+
|
|
3
|
+
Class to help with base64 URL Encoding/Decoding.
|
|
4
|
+
https://www.rfc-editor.org/rfc/rfc4648#section-5.
|
|
5
|
+
|
|
6
|
+
## Constructors
|
|
7
|
+
|
|
8
|
+
### new Base64Url()
|
|
9
|
+
|
|
10
|
+
> **new Base64Url**(): [`Base64Url`](Base64Url.md)
|
|
11
|
+
|
|
12
|
+
#### Returns
|
|
13
|
+
|
|
14
|
+
[`Base64Url`](Base64Url.md)
|
|
15
|
+
|
|
16
|
+
## Methods
|
|
17
|
+
|
|
18
|
+
### decode()
|
|
19
|
+
|
|
20
|
+
> `static` **decode**(`base64Url`): `Uint8Array`
|
|
21
|
+
|
|
22
|
+
Convert the base 64 string to a byte array.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
• **base64Url**: `string`
|
|
27
|
+
|
|
28
|
+
The base64 url string to convert.
|
|
29
|
+
|
|
30
|
+
#### Returns
|
|
31
|
+
|
|
32
|
+
`Uint8Array`
|
|
33
|
+
|
|
34
|
+
The byte array.
|
|
35
|
+
|
|
36
|
+
***
|
|
37
|
+
|
|
38
|
+
### encode()
|
|
39
|
+
|
|
40
|
+
> `static` **encode**(`bytes`): `string`
|
|
41
|
+
|
|
42
|
+
Convert a byte array to base 64 url.
|
|
43
|
+
|
|
44
|
+
#### Parameters
|
|
45
|
+
|
|
46
|
+
• **bytes**: `Uint8Array`
|
|
47
|
+
|
|
48
|
+
The byte array to convert.
|
|
49
|
+
|
|
50
|
+
#### Returns
|
|
51
|
+
|
|
52
|
+
`string`
|
|
53
|
+
|
|
54
|
+
The data as base64 url string.
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# Class: BaseError
|
|
2
|
+
|
|
3
|
+
Class to handle errors.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `Error`
|
|
8
|
+
|
|
9
|
+
## Extended by
|
|
10
|
+
|
|
11
|
+
- [`AlreadyExistsError`](AlreadyExistsError.md)
|
|
12
|
+
- [`ConflictError`](ConflictError.md)
|
|
13
|
+
- [`GeneralError`](GeneralError.md)
|
|
14
|
+
- [`GuardError`](GuardError.md)
|
|
15
|
+
- [`NotFoundError`](NotFoundError.md)
|
|
16
|
+
- [`NotImplementedError`](NotImplementedError.md)
|
|
17
|
+
- [`NotSupportedError`](NotSupportedError.md)
|
|
18
|
+
- [`UnauthorizedError`](UnauthorizedError.md)
|
|
19
|
+
- [`UnprocessableError`](UnprocessableError.md)
|
|
20
|
+
- [`ValidationError`](ValidationError.md)
|
|
21
|
+
|
|
22
|
+
## Implements
|
|
23
|
+
|
|
24
|
+
- [`IError`](../interfaces/IError.md)
|
|
25
|
+
|
|
26
|
+
## Constructors
|
|
27
|
+
|
|
28
|
+
### new BaseError()
|
|
29
|
+
|
|
30
|
+
> **new BaseError**(`name`, `source`, `message`, `properties`?, `inner`?): [`BaseError`](BaseError.md)
|
|
31
|
+
|
|
32
|
+
Create a new instance of BaseError.
|
|
33
|
+
|
|
34
|
+
#### Parameters
|
|
35
|
+
|
|
36
|
+
• **name**: `string`
|
|
37
|
+
|
|
38
|
+
The name of the error.
|
|
39
|
+
|
|
40
|
+
• **source**: `string`
|
|
41
|
+
|
|
42
|
+
The source of the error.
|
|
43
|
+
|
|
44
|
+
• **message**: `string`
|
|
45
|
+
|
|
46
|
+
The message as a code.
|
|
47
|
+
|
|
48
|
+
• **properties?**
|
|
49
|
+
|
|
50
|
+
Any additional information for the error.
|
|
51
|
+
|
|
52
|
+
• **inner?**: `unknown`
|
|
53
|
+
|
|
54
|
+
The inner error if we have wrapped another error.
|
|
55
|
+
|
|
56
|
+
#### Returns
|
|
57
|
+
|
|
58
|
+
[`BaseError`](BaseError.md)
|
|
59
|
+
|
|
60
|
+
#### Overrides
|
|
61
|
+
|
|
62
|
+
`Error.constructor`
|
|
63
|
+
|
|
64
|
+
## Properties
|
|
65
|
+
|
|
66
|
+
### source?
|
|
67
|
+
|
|
68
|
+
> `optional` **source**: `string`
|
|
69
|
+
|
|
70
|
+
The source of the error.
|
|
71
|
+
|
|
72
|
+
#### Implementation of
|
|
73
|
+
|
|
74
|
+
[`IError`](../interfaces/IError.md).[`source`](../interfaces/IError.md#source)
|
|
75
|
+
|
|
76
|
+
***
|
|
77
|
+
|
|
78
|
+
### properties?
|
|
79
|
+
|
|
80
|
+
> `optional` **properties**: `object`
|
|
81
|
+
|
|
82
|
+
Any additional information for the error.
|
|
83
|
+
|
|
84
|
+
#### Index Signature
|
|
85
|
+
|
|
86
|
+
\[`id`: `string`\]: `unknown`
|
|
87
|
+
|
|
88
|
+
#### Implementation of
|
|
89
|
+
|
|
90
|
+
[`IError`](../interfaces/IError.md).[`properties`](../interfaces/IError.md#properties)
|
|
91
|
+
|
|
92
|
+
***
|
|
93
|
+
|
|
94
|
+
### inner?
|
|
95
|
+
|
|
96
|
+
> `optional` **inner**: [`IError`](../interfaces/IError.md)
|
|
97
|
+
|
|
98
|
+
The inner error if there was one.
|
|
99
|
+
|
|
100
|
+
#### Implementation of
|
|
101
|
+
|
|
102
|
+
[`IError`](../interfaces/IError.md).[`inner`](../interfaces/IError.md#inner)
|
|
103
|
+
|
|
104
|
+
## Methods
|
|
105
|
+
|
|
106
|
+
### fromError()
|
|
107
|
+
|
|
108
|
+
> `static` **fromError**(`err`): [`BaseError`](BaseError.md)
|
|
109
|
+
|
|
110
|
+
Construct an error from an existing one.
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
• **err**: `unknown`
|
|
115
|
+
|
|
116
|
+
The existing error.
|
|
117
|
+
|
|
118
|
+
#### Returns
|
|
119
|
+
|
|
120
|
+
[`BaseError`](BaseError.md)
|
|
121
|
+
|
|
122
|
+
The new instance.
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
126
|
+
### flatten()
|
|
127
|
+
|
|
128
|
+
> `static` **flatten**(`err`): [`IError`](../interfaces/IError.md)[]
|
|
129
|
+
|
|
130
|
+
Flatten an error tree.
|
|
131
|
+
|
|
132
|
+
#### Parameters
|
|
133
|
+
|
|
134
|
+
• **err**: `unknown`
|
|
135
|
+
|
|
136
|
+
The starting error.
|
|
137
|
+
|
|
138
|
+
#### Returns
|
|
139
|
+
|
|
140
|
+
[`IError`](../interfaces/IError.md)[]
|
|
141
|
+
|
|
142
|
+
The list of all internal errors.
|
|
143
|
+
|
|
144
|
+
***
|
|
145
|
+
|
|
146
|
+
### expand()
|
|
147
|
+
|
|
148
|
+
> `static` **expand**(`errors`): `undefined` \| [`IError`](../interfaces/IError.md)
|
|
149
|
+
|
|
150
|
+
Expand an error tree.
|
|
151
|
+
|
|
152
|
+
#### Parameters
|
|
153
|
+
|
|
154
|
+
• **errors**: `undefined` \| [`IError`](../interfaces/IError.md)[]
|
|
155
|
+
|
|
156
|
+
The list of errors to expand.
|
|
157
|
+
|
|
158
|
+
#### Returns
|
|
159
|
+
|
|
160
|
+
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
161
|
+
|
|
162
|
+
The first level error.
|
|
163
|
+
|
|
164
|
+
***
|
|
165
|
+
|
|
166
|
+
### isErrorName()
|
|
167
|
+
|
|
168
|
+
> `static` **isErrorName**(`error`, `name`): `error is BaseError`
|
|
169
|
+
|
|
170
|
+
Test to see if the error has the specified error name.
|
|
171
|
+
|
|
172
|
+
#### Parameters
|
|
173
|
+
|
|
174
|
+
• **error**: `unknown`
|
|
175
|
+
|
|
176
|
+
The error to test.
|
|
177
|
+
|
|
178
|
+
• **name**: `string` \| `RegExp`
|
|
179
|
+
|
|
180
|
+
The name to check for.
|
|
181
|
+
|
|
182
|
+
#### Returns
|
|
183
|
+
|
|
184
|
+
`error is BaseError`
|
|
185
|
+
|
|
186
|
+
True if the error has the name.
|
|
187
|
+
|
|
188
|
+
***
|
|
189
|
+
|
|
190
|
+
### isErrorMessage()
|
|
191
|
+
|
|
192
|
+
> `static` **isErrorMessage**(`error`, `message`): `error is BaseError`
|
|
193
|
+
|
|
194
|
+
Test to see if the error has the specified error message.
|
|
195
|
+
|
|
196
|
+
#### Parameters
|
|
197
|
+
|
|
198
|
+
• **error**: `unknown`
|
|
199
|
+
|
|
200
|
+
The error to test.
|
|
201
|
+
|
|
202
|
+
• **message**: `string` \| `RegExp`
|
|
203
|
+
|
|
204
|
+
The message to check for.
|
|
205
|
+
|
|
206
|
+
#### Returns
|
|
207
|
+
|
|
208
|
+
`error is BaseError`
|
|
209
|
+
|
|
210
|
+
True if the error has the name.
|
|
211
|
+
|
|
212
|
+
***
|
|
213
|
+
|
|
214
|
+
### isErrorCode()
|
|
215
|
+
|
|
216
|
+
> `static` **isErrorCode**(`error`, `code`): `boolean`
|
|
217
|
+
|
|
218
|
+
Test to see if the error has the specified error code.
|
|
219
|
+
|
|
220
|
+
#### Parameters
|
|
221
|
+
|
|
222
|
+
• **error**: `unknown`
|
|
223
|
+
|
|
224
|
+
The error to test.
|
|
225
|
+
|
|
226
|
+
• **code**: `string` \| `RegExp`
|
|
227
|
+
|
|
228
|
+
The code to check for.
|
|
229
|
+
|
|
230
|
+
#### Returns
|
|
231
|
+
|
|
232
|
+
`boolean`
|
|
233
|
+
|
|
234
|
+
True if the error has the code.
|
|
235
|
+
|
|
236
|
+
***
|
|
237
|
+
|
|
238
|
+
### someErrorName()
|
|
239
|
+
|
|
240
|
+
> `static` **someErrorName**(`error`, `name`): `error is BaseError`
|
|
241
|
+
|
|
242
|
+
Test to see if any of the errors or children have the given error name.
|
|
243
|
+
|
|
244
|
+
#### Parameters
|
|
245
|
+
|
|
246
|
+
• **error**: `unknown`
|
|
247
|
+
|
|
248
|
+
The error to test.
|
|
249
|
+
|
|
250
|
+
• **name**: `string` \| `RegExp`
|
|
251
|
+
|
|
252
|
+
The name to check for.
|
|
253
|
+
|
|
254
|
+
#### Returns
|
|
255
|
+
|
|
256
|
+
`error is BaseError`
|
|
257
|
+
|
|
258
|
+
True if the error has the name.
|
|
259
|
+
|
|
260
|
+
***
|
|
261
|
+
|
|
262
|
+
### someErrorMessage()
|
|
263
|
+
|
|
264
|
+
> `static` **someErrorMessage**(`error`, `message`): `error is BaseError`
|
|
265
|
+
|
|
266
|
+
Test to see if any of the errors or children have the given error message.
|
|
267
|
+
|
|
268
|
+
#### Parameters
|
|
269
|
+
|
|
270
|
+
• **error**: `unknown`
|
|
271
|
+
|
|
272
|
+
The error to test.
|
|
273
|
+
|
|
274
|
+
• **message**: `string` \| `RegExp`
|
|
275
|
+
|
|
276
|
+
The message to check for.
|
|
277
|
+
|
|
278
|
+
#### Returns
|
|
279
|
+
|
|
280
|
+
`error is BaseError`
|
|
281
|
+
|
|
282
|
+
True if the error has the name.
|
|
283
|
+
|
|
284
|
+
***
|
|
285
|
+
|
|
286
|
+
### someErrorClass()
|
|
287
|
+
|
|
288
|
+
> `static` **someErrorClass**(`error`, `cls`): `error is BaseError`
|
|
289
|
+
|
|
290
|
+
Test to see if any of the errors or children are from a specific class.
|
|
291
|
+
|
|
292
|
+
#### Parameters
|
|
293
|
+
|
|
294
|
+
• **error**: `unknown`
|
|
295
|
+
|
|
296
|
+
The error to test.
|
|
297
|
+
|
|
298
|
+
• **cls**: `string`
|
|
299
|
+
|
|
300
|
+
The class to check for.
|
|
301
|
+
|
|
302
|
+
#### Returns
|
|
303
|
+
|
|
304
|
+
`error is BaseError`
|
|
305
|
+
|
|
306
|
+
True if the error has the specific class.
|
|
307
|
+
|
|
308
|
+
***
|
|
309
|
+
|
|
310
|
+
### someErrorCode()
|
|
311
|
+
|
|
312
|
+
> `static` **someErrorCode**(`error`, `code`): `error is BaseError`
|
|
313
|
+
|
|
314
|
+
Test to see if any of the errors or children have the given error code.
|
|
315
|
+
|
|
316
|
+
#### Parameters
|
|
317
|
+
|
|
318
|
+
• **error**: `unknown`
|
|
319
|
+
|
|
320
|
+
The error to test.
|
|
321
|
+
|
|
322
|
+
• **code**: `string` \| `RegExp`
|
|
323
|
+
|
|
324
|
+
The code to check for.
|
|
325
|
+
|
|
326
|
+
#### Returns
|
|
327
|
+
|
|
328
|
+
`error is BaseError`
|
|
329
|
+
|
|
330
|
+
True if the error has the name.
|
|
331
|
+
|
|
332
|
+
***
|
|
333
|
+
|
|
334
|
+
### toJsonObject()
|
|
335
|
+
|
|
336
|
+
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
337
|
+
|
|
338
|
+
Serialize the error to the error model.
|
|
339
|
+
|
|
340
|
+
#### Returns
|
|
341
|
+
|
|
342
|
+
[`IError`](../interfaces/IError.md)
|
|
343
|
+
|
|
344
|
+
The error model.
|