@twin.org/core 0.0.1-next.5 → 0.0.1-next.50

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 (66) hide show
  1. package/dist/cjs/index.cjs +1401 -736
  2. package/dist/esm/index.mjs +1398 -737
  3. package/dist/types/encoding/base58.d.ts +18 -0
  4. package/dist/types/factories/factory.d.ts +20 -1
  5. package/dist/types/helpers/envHelper.d.ts +16 -0
  6. package/dist/types/helpers/jsonHelper.d.ts +30 -0
  7. package/dist/types/helpers/objectHelper.d.ts +33 -0
  8. package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
  9. package/dist/types/index.d.ts +4 -0
  10. package/dist/types/models/IComponent.d.ts +12 -3
  11. package/dist/types/models/coerceType.d.ts +49 -0
  12. package/dist/types/models/compressionType.d.ts +1 -1
  13. package/dist/types/utils/asyncCache.d.ts +8 -0
  14. package/dist/types/utils/coerce.d.ts +22 -0
  15. package/dist/types/utils/converter.d.ts +12 -0
  16. package/dist/types/utils/guards.d.ts +16 -0
  17. package/dist/types/utils/is.d.ts +12 -0
  18. package/dist/types/utils/validation.d.ts +2 -0
  19. package/docs/changelog.md +8 -1
  20. package/docs/reference/classes/AlreadyExistsError.md +67 -25
  21. package/docs/reference/classes/ArrayHelper.md +6 -2
  22. package/docs/reference/classes/AsyncCache.md +56 -6
  23. package/docs/reference/classes/Base32.md +6 -2
  24. package/docs/reference/classes/Base58.md +61 -0
  25. package/docs/reference/classes/Base64.md +9 -3
  26. package/docs/reference/classes/Base64Url.md +6 -2
  27. package/docs/reference/classes/BaseError.md +65 -23
  28. package/docs/reference/classes/BitString.md +18 -6
  29. package/docs/reference/classes/Coerce.md +104 -8
  30. package/docs/reference/classes/Compression.md +16 -8
  31. package/docs/reference/classes/ConflictError.md +70 -26
  32. package/docs/reference/classes/Converter.md +104 -20
  33. package/docs/reference/classes/EnvHelper.md +43 -0
  34. package/docs/reference/classes/ErrorHelper.md +9 -3
  35. package/docs/reference/classes/Factory.md +78 -10
  36. package/docs/reference/classes/FilenameHelper.md +3 -1
  37. package/docs/reference/classes/GeneralError.md +65 -25
  38. package/docs/reference/classes/GuardError.md +70 -26
  39. package/docs/reference/classes/Guards.md +286 -74
  40. package/docs/reference/classes/HexHelper.md +15 -5
  41. package/docs/reference/classes/I18n.md +42 -16
  42. package/docs/reference/classes/Is.md +160 -44
  43. package/docs/reference/classes/JsonHelper.md +137 -5
  44. package/docs/reference/classes/NotFoundError.md +67 -25
  45. package/docs/reference/classes/NotImplementedError.md +61 -23
  46. package/docs/reference/classes/NotSupportedError.md +64 -24
  47. package/docs/reference/classes/ObjectHelper.md +188 -20
  48. package/docs/reference/classes/RandomHelper.md +3 -1
  49. package/docs/reference/classes/StringHelper.md +51 -17
  50. package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
  51. package/docs/reference/classes/UnauthorizedError.md +64 -24
  52. package/docs/reference/classes/UnprocessableError.md +65 -25
  53. package/docs/reference/classes/Url.md +30 -10
  54. package/docs/reference/classes/Urn.md +54 -18
  55. package/docs/reference/classes/Validation.md +315 -109
  56. package/docs/reference/classes/ValidationError.md +64 -24
  57. package/docs/reference/index.md +5 -0
  58. package/docs/reference/interfaces/IComponent.md +30 -8
  59. package/docs/reference/interfaces/IError.md +1 -1
  60. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  61. package/docs/reference/interfaces/IValidationFailure.md +1 -1
  62. package/docs/reference/type-aliases/CoerceType.md +5 -0
  63. package/docs/reference/variables/CoerceType.md +67 -0
  64. package/docs/reference/variables/CompressionType.md +1 -1
  65. package/locales/en.json +21 -1
  66. package/package.json +6 -6
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Class to help with base58 Encoding/Decoding.
3
+ */
4
+ export declare class Base58 {
5
+ /**
6
+ * Convert the base 58 string to a byte array.
7
+ * @param base58 The base58 string to convert.
8
+ * @returns The byte array.
9
+ * @throws If the input string contains a character not in the Base58 alphabet.
10
+ */
11
+ static decode(base58: string): Uint8Array;
12
+ /**
13
+ * Convert a byte array to base 58.
14
+ * @param bytes The byte array to encode.
15
+ * @returns The data as base58 string.
16
+ */
17
+ static encode(bytes: Uint8Array): string;
18
+ }
@@ -10,6 +10,21 @@ export declare class Factory<T> {
10
10
  * @returns The factory instance.
11
11
  */
12
12
  static createFactory<U>(typeName: string, autoInstance?: boolean, matcher?: (names: string[], name: string) => string | undefined): Factory<U>;
13
+ /**
14
+ * Get all the factories.
15
+ * @returns All the factories.
16
+ */
17
+ static getFactories(): {
18
+ [typeName: string]: Factory<unknown>;
19
+ };
20
+ /**
21
+ * Reset all the factories, which removes any created instances, but not the registrations.
22
+ */
23
+ static resetFactories(): void;
24
+ /**
25
+ * Clear all the factories, which removes anything registered with the factories.
26
+ */
27
+ static clearFactories(): void;
13
28
  /**
14
29
  * Register a new generator.
15
30
  * @param name The name of the generator.
@@ -38,9 +53,13 @@ export declare class Factory<T> {
38
53
  */
39
54
  getIfExists<U extends T>(name: string): U | undefined;
40
55
  /**
41
- * Reset all the instances.
56
+ * Remove all the instances and leave the generators intact.
42
57
  */
43
58
  reset(): void;
59
+ /**
60
+ * Remove all the instances and the generators.
61
+ */
62
+ clear(): void;
44
63
  /**
45
64
  * Get all the instances as a map.
46
65
  * @returns The instances as a map.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Environment variable helper.
3
+ */
4
+ export declare class EnvHelper {
5
+ /**
6
+ * Get the environment variable as an object with camel cased names.
7
+ * @param envVars The environment variables.
8
+ * @param prefix The prefix of the environment variables, if not provided gets all.
9
+ * @returns The object with camel cased names.
10
+ */
11
+ static envToJson<T = {
12
+ [id: string]: string;
13
+ }>(envVars: {
14
+ [id: string]: string | undefined;
15
+ }, prefix?: string): T;
16
+ }
@@ -24,6 +24,36 @@ export declare class JsonHelper {
24
24
  * @param object The object to patch.
25
25
  * @param patches The second object.
26
26
  * @returns The updated object.
27
+ * @throws GeneralError if the patch fails.
27
28
  */
28
29
  static patch<T = unknown>(object: T, patches: IPatchOperation[]): T;
30
+ /**
31
+ * Stringify the JSON with support for extended data types date/bigint/uint8array.
32
+ * @param object The object to stringify.
33
+ * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
34
+ * @returns The stringified object.
35
+ */
36
+ static stringifyEx(object: any, space?: string | number): string;
37
+ /**
38
+ * Parse the JSON string with support for extended data types date/bigint/uint8array.
39
+ * @param json The object to pause.
40
+ * @returns The object.
41
+ */
42
+ static parseEx(json: string): any;
43
+ /**
44
+ * Replacer function to handle extended data types.
45
+ * @param this The object.
46
+ * @param key The key.
47
+ * @param value The value.
48
+ * @returns The value.
49
+ */
50
+ static stringifyExReplacer(this: any, key: string, value: unknown): unknown;
51
+ /**
52
+ * Reviver function to handle extended data types.
53
+ * @param this The object.
54
+ * @param key The key.
55
+ * @param value The value.
56
+ * @returns The value.
57
+ */
58
+ static parseExReviver(this: any, key: string, value: unknown): unknown;
29
59
  }
@@ -49,6 +49,7 @@ export declare class ObjectHelper {
49
49
  * @param obj The object to set the property from.
50
50
  * @param property The property to set.
51
51
  * @param value The value to set.
52
+ * @throws GeneralError if the property target is not an object.
52
53
  */
53
54
  static propertySet(obj: unknown, property: string, value: unknown): void;
54
55
  /**
@@ -57,6 +58,14 @@ export declare class ObjectHelper {
57
58
  * @param property The property to set
58
59
  */
59
60
  static propertyDelete(obj: unknown, property: string): void;
61
+ /**
62
+ * Extract a property from the object, providing alternative names.
63
+ * @param obj The object to extract from.
64
+ * @param propertyNames The possible names for the property.
65
+ * @param removeProperties Remove the properties from the object, defaults to true.
66
+ * @returns The property if available.
67
+ */
68
+ static extractProperty<T>(obj: unknown, propertyNames: string | string[], removeProperties?: boolean): T | undefined;
60
69
  /**
61
70
  * Pick a subset of properties from an object.
62
71
  * @param obj The object to pick the properties from.
@@ -71,4 +80,28 @@ export declare class ObjectHelper {
71
80
  * @returns The partial object.
72
81
  */
73
82
  static omit<T>(obj: T | undefined, keys?: (keyof T)[]): Partial<T>;
83
+ /**
84
+ * Converter the non JSON primitives to extended types.
85
+ * @param obj The object to convert.
86
+ * @returns The object with extended properties.
87
+ */
88
+ static toExtended(obj: any): any;
89
+ /**
90
+ * Converter the extended types to non JSON primitives.
91
+ * @param obj The object to convert.
92
+ * @returns The object with regular properties.
93
+ */
94
+ static fromExtended(obj: any): any;
95
+ /**
96
+ * Remove empty properties from an object.
97
+ * @param obj The object to remove the empty properties from.
98
+ * @param options The options for the removal.
99
+ * @param options.removeUndefined Remove undefined properties, defaults to true.
100
+ * @param options.removeNull Remove null properties, defaults to false.
101
+ * @returns The object with empty properties removed.
102
+ */
103
+ static removeEmptyProperties<T = unknown>(obj: T, options?: {
104
+ removeUndefined?: boolean;
105
+ removeNull?: boolean;
106
+ }): T;
74
107
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Class to help with uint8 arrays.
3
+ */
4
+ export declare class Uint8ArrayHelper {
5
+ /**
6
+ * Concatenate multiple arrays.
7
+ * @param arrays The array to concatenate.
8
+ * @returns The combined array.
9
+ */
10
+ static concat(arrays: Uint8Array[]): Uint8Array;
11
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./encoding/base32";
2
+ export * from "./encoding/base58";
2
3
  export * from "./encoding/base64";
3
4
  export * from "./encoding/base64Url";
4
5
  export * from "./errors/alreadyExistsError";
@@ -15,6 +16,7 @@ export * from "./errors/validationError";
15
16
  export * from "./factories/componentFactory";
16
17
  export * from "./factories/factory";
17
18
  export * from "./helpers/arrayHelper";
19
+ export * from "./helpers/envHelper";
18
20
  export * from "./helpers/errorHelper";
19
21
  export * from "./helpers/filenameHelper";
20
22
  export * from "./helpers/hexHelper";
@@ -22,6 +24,8 @@ export * from "./helpers/jsonHelper";
22
24
  export * from "./helpers/objectHelper";
23
25
  export * from "./helpers/randomHelper";
24
26
  export * from "./helpers/stringHelper";
27
+ export * from "./helpers/uint8ArrayHelper";
28
+ export * from "./models/coerceType";
25
29
  export * from "./models/compressionType";
26
30
  export * from "./models/IComponent";
27
31
  export * from "./models/IError";
@@ -9,21 +9,30 @@ export interface IComponent {
9
9
  /**
10
10
  * Bootstrap the component by creating and initializing any resources it needs.
11
11
  * @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
12
+ * @param componentState A persistent state which can be modified by the method.
12
13
  * @returns True if the bootstrapping process was successful.
13
14
  */
14
- bootstrap?(nodeLoggingConnectorType?: string): Promise<boolean>;
15
+ bootstrap?(nodeLoggingConnectorType: string | undefined, componentState?: {
16
+ [id: string]: unknown;
17
+ }): Promise<boolean>;
15
18
  /**
16
19
  * The component needs to be started when the node is initialized.
17
20
  * @param nodeIdentity The identity of the node starting the component.
18
21
  * @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
22
+ * @param componentState A persistent state which can be modified by the method.
19
23
  * @returns Nothing.
20
24
  */
21
- start?(nodeIdentity: string, nodeLoggingConnectorType?: string): Promise<void>;
25
+ start?(nodeIdentity: string, nodeLoggingConnectorType: string | undefined, componentState?: {
26
+ [id: string]: unknown;
27
+ }): Promise<void>;
22
28
  /**
23
29
  * The component needs to be stopped when the node is closed.
24
30
  * @param nodeIdentity The identity of the node stopping the component.
25
31
  * @param nodeLoggingConnectorType The node logging connector type, defaults to "node-logging".
32
+ * @param componentState A persistent state which can be modified by the method.
26
33
  * @returns Nothing.
27
34
  */
28
- stop?(nodeIdentity: string, nodeLoggingConnectorType?: string): Promise<void>;
35
+ stop?(nodeIdentity: string, nodeLoggingConnectorType: string | undefined, componentState?: {
36
+ [id: string]: unknown;
37
+ }): Promise<void>;
29
38
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The types the extracted data can be coerced to.
3
+ */
4
+ export declare const CoerceType: {
5
+ /**
6
+ * String.
7
+ */
8
+ readonly String: "string";
9
+ /**
10
+ * Number.
11
+ */
12
+ readonly Number: "number";
13
+ /**
14
+ * Integer.
15
+ */
16
+ readonly Integer: "integer";
17
+ /**
18
+ * Boolean.
19
+ */
20
+ readonly Boolean: "boolean";
21
+ /**
22
+ * Big Integer.
23
+ */
24
+ readonly BigInt: "bigint";
25
+ /**
26
+ * Date.
27
+ */
28
+ readonly Date: "date";
29
+ /**
30
+ * Date Time.
31
+ */
32
+ readonly DateTime: "datetime";
33
+ /**
34
+ * Time.
35
+ */
36
+ readonly Time: "time";
37
+ /**
38
+ * Object.
39
+ */
40
+ readonly Object: "object";
41
+ /**
42
+ * Uint8Array.
43
+ */
44
+ readonly Uint8Array: "uint8array";
45
+ };
46
+ /**
47
+ * The types the extracted data can be coerced to.
48
+ */
49
+ export type CoerceType = (typeof CoerceType)[keyof typeof CoerceType];
@@ -7,7 +7,7 @@ export declare const CompressionType: {
7
7
  */
8
8
  readonly Gzip: "gzip";
9
9
  /**
10
- * deflate.
10
+ * Deflate.
11
11
  */
12
12
  readonly Deflate: "deflate";
13
13
  };
@@ -16,6 +16,14 @@ export declare class AsyncCache {
16
16
  * @returns The item from the cache if it exists.
17
17
  */
18
18
  static get<T = unknown>(key: string): Promise<T | undefined>;
19
+ /**
20
+ * Set an entry into the cache.
21
+ * @param key The key to set in the cache.
22
+ * @param value The value to set in the cache.
23
+ * @param ttlMs The TTL of the entry in the cache in ms, defaults to 1s.
24
+ * @returns Nothing.
25
+ */
26
+ static set<T = unknown>(key: string, value: T, ttlMs?: number): Promise<void>;
19
27
  /**
20
28
  * Remove an entry from the cache.
21
29
  * @param key The key to remove from the cache.
@@ -1,3 +1,4 @@
1
+ import { CoerceType } from "../models/coerceType";
1
2
  /**
2
3
  * Coerce an object from one type to another.
3
4
  */
@@ -16,6 +17,13 @@ export declare class Coerce {
16
17
  * @returns The value if it can be coerced.
17
18
  */
18
19
  static number(value: unknown): number | undefined;
20
+ /**
21
+ * Coerce the value to an integer.
22
+ * @param value The value to coerce.
23
+ * @throws TypeError If the value can not be coerced.
24
+ * @returns The value if it can be coerced.
25
+ */
26
+ static integer(value: unknown): number | undefined;
19
27
  /**
20
28
  * Coerce the value to a bigint.
21
29
  * @param value The value to coerce.
@@ -58,4 +66,18 @@ export declare class Coerce {
58
66
  * @returns The value if it can be coerced.
59
67
  */
60
68
  static object<T = unknown>(value: unknown): T | undefined;
69
+ /**
70
+ * Coerce the value to a Uint8Array.
71
+ * @param value The value to coerce.
72
+ * @throws TypeError If the value can not be coerced.
73
+ * @returns The value if it can be coerced.
74
+ */
75
+ static uint8Array(value: unknown): Uint8Array | undefined;
76
+ /**
77
+ * Coerces a value based on the coercion type.
78
+ * @param value The value to coerce.
79
+ * @param type The coercion type to perform.
80
+ * @returns The coerced value.
81
+ */
82
+ static byType(value: unknown, type?: CoerceType): unknown;
61
83
  }
@@ -82,4 +82,16 @@ export declare class Converter {
82
82
  * @returns The bytes.
83
83
  */
84
84
  static base64UrlToBytes(base64Url: string): Uint8Array;
85
+ /**
86
+ * Convert bytes to base58 string.
87
+ * @param bytes The bytes to convert.
88
+ * @returns A base58 string of the bytes.
89
+ */
90
+ static bytesToBase58(bytes: Uint8Array): string;
91
+ /**
92
+ * Convert a base58 string to bytes.
93
+ * @param base58 The base58 string.
94
+ * @returns The bytes.
95
+ */
96
+ static base58ToBytes(base58: string): Uint8Array;
85
97
  }
@@ -26,6 +26,14 @@ export declare class Guards {
26
26
  * @throws GuardError If the value does not match the assertion.
27
27
  */
28
28
  static stringValue(source: string, property: string, value: unknown): asserts value is string;
29
+ /**
30
+ * Is the property a JSON value.
31
+ * @param source The source of the error.
32
+ * @param property The name of the property.
33
+ * @param value The value to test.
34
+ * @throws GuardError If the value does not match the assertion.
35
+ */
36
+ static json(source: string, property: string, value: unknown): asserts value is string;
29
37
  /**
30
38
  * Is the property a base64 string.
31
39
  * @param source The source of the error.
@@ -42,6 +50,14 @@ export declare class Guards {
42
50
  * @throws GuardError If the value does not match the assertion.
43
51
  */
44
52
  static stringBase64Url(source: string, property: string, value: unknown): asserts value is string;
53
+ /**
54
+ * Is the property a base58 string.
55
+ * @param source The source of the error.
56
+ * @param property The name of the property.
57
+ * @param value The value to test.
58
+ * @throws GuardError If the value does not match the assertion.
59
+ */
60
+ static stringBase58(source: string, property: string, value: unknown): asserts value is string;
45
61
  /**
46
62
  * Is the property a string with a hex value.
47
63
  * @param source The source of the error.
@@ -56,6 +56,12 @@ export declare class Is {
56
56
  * @returns True if the value is a base64 string.
57
57
  */
58
58
  static stringBase64Url(value: unknown): value is string;
59
+ /**
60
+ * Is the value a base58 string.
61
+ * @param value The value to test.
62
+ * @returns True if the value is a base58 string.
63
+ */
64
+ static stringBase58(value: unknown): value is string;
59
65
  /**
60
66
  * Is the value a hex string.
61
67
  * @param value The value to test.
@@ -202,4 +208,10 @@ export declare class Is {
202
208
  * @returns True if the value is a promise.
203
209
  */
204
210
  static promise<T = unknown>(value: unknown): value is Promise<T>;
211
+ /**
212
+ * Is the value a regexp.
213
+ * @param value The value to test.
214
+ * @returns True if the value is a regexp.
215
+ */
216
+ static regexp(value: unknown): value is RegExp;
205
217
  }
@@ -30,9 +30,11 @@ export declare class Validation {
30
30
  * @param options Additional options for the validation.
31
31
  * @param options.minLength The minimum length of the string.
32
32
  * @param options.maxLength The maximum length of the string.
33
+ * @param options.format Specific format to check.
33
34
  * @returns True if the value is a valid string.
34
35
  */
35
36
  static string(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
37
+ format?: "base64" | "base58" | "hex" | RegExp;
36
38
  minLength?: number;
37
39
  maxLength?: number;
38
40
  }): value is string;
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/core - Changelog
2
2
 
3
- ## 0.0.1-next.5
3
+ ## [0.0.1-next.50](https://github.com/twinfoundation/framework/compare/core-v0.0.1-next.49...core-v0.0.1-next.50) (2025-03-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
9
+
10
+ ## 0.0.1-next.49
4
11
 
5
12
  - Initial Release
@@ -16,19 +16,27 @@ Create a new instance of AlreadyExistsError.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **source**: `string`
19
+ ##### source
20
+
21
+ `string`
20
22
 
21
23
  The source of the error.
22
24
 
23
- **message**: `string`
25
+ ##### message
26
+
27
+ `string`
24
28
 
25
29
  The message as a code.
26
30
 
27
- **existingId?**: `string`
31
+ ##### existingId?
32
+
33
+ `string`
28
34
 
29
35
  The id for the item.
30
36
 
31
- **inner?**: `unknown`
37
+ ##### inner?
38
+
39
+ `unknown`
32
40
 
33
41
  The inner error if we have wrapped another error.
34
42
 
@@ -58,7 +66,7 @@ The source of the error.
58
66
 
59
67
  #### Inherited from
60
68
 
61
- [`BaseError`](BaseError.md).[`source`](BaseError.md#source)
69
+ [`BaseError`](BaseError.md).[`source`](BaseError.md#source-1)
62
70
 
63
71
  ***
64
72
 
@@ -70,11 +78,11 @@ Any additional information for the error.
70
78
 
71
79
  #### Index Signature
72
80
 
73
- \[`id`: `string`\]: `unknown`
81
+ \[`id`: `string`\]: `unknown`
74
82
 
75
83
  #### Inherited from
76
84
 
77
- [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties)
85
+ [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties-1)
78
86
 
79
87
  ***
80
88
 
@@ -86,7 +94,7 @@ The inner error if there was one.
86
94
 
87
95
  #### Inherited from
88
96
 
89
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
97
+ [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner-1)
90
98
 
91
99
  ## Methods
92
100
 
@@ -98,7 +106,9 @@ Construct an error from an existing one.
98
106
 
99
107
  #### Parameters
100
108
 
101
- **err**: `unknown`
109
+ ##### err
110
+
111
+ `unknown`
102
112
 
103
113
  The existing error.
104
114
 
@@ -122,7 +132,9 @@ Flatten an error tree.
122
132
 
123
133
  #### Parameters
124
134
 
125
- **err**: `unknown`
135
+ ##### err
136
+
137
+ `unknown`
126
138
 
127
139
  The starting error.
128
140
 
@@ -146,10 +158,12 @@ Expand an error tree.
146
158
 
147
159
  #### Parameters
148
160
 
149
- **errors**: `undefined` \| [`IError`](../interfaces/IError.md)[]
161
+ ##### errors
150
162
 
151
163
  The list of errors to expand.
152
164
 
165
+ `undefined` | [`IError`](../interfaces/IError.md)[]
166
+
153
167
  #### Returns
154
168
 
155
169
  `undefined` \| [`IError`](../interfaces/IError.md)
@@ -170,14 +184,18 @@ Test to see if the error has the specified error name.
170
184
 
171
185
  #### Parameters
172
186
 
173
- **error**: `unknown`
187
+ ##### error
188
+
189
+ `unknown`
174
190
 
175
191
  The error to test.
176
192
 
177
- **name**: `string` \| `RegExp`
193
+ ##### name
178
194
 
179
195
  The name to check for.
180
196
 
197
+ `string` | `RegExp`
198
+
181
199
  #### Returns
182
200
 
183
201
  `error is BaseError`
@@ -198,14 +216,18 @@ Test to see if the error has the specified error message.
198
216
 
199
217
  #### Parameters
200
218
 
201
- **error**: `unknown`
219
+ ##### error
220
+
221
+ `unknown`
202
222
 
203
223
  The error to test.
204
224
 
205
- **message**: `string` \| `RegExp`
225
+ ##### message
206
226
 
207
227
  The message to check for.
208
228
 
229
+ `string` | `RegExp`
230
+
209
231
  #### Returns
210
232
 
211
233
  `error is BaseError`
@@ -226,14 +248,18 @@ Test to see if the error has the specified error code.
226
248
 
227
249
  #### Parameters
228
250
 
229
- **error**: `unknown`
251
+ ##### error
252
+
253
+ `unknown`
230
254
 
231
255
  The error to test.
232
256
 
233
- **code**: `string` \| `RegExp`
257
+ ##### code
234
258
 
235
259
  The code to check for.
236
260
 
261
+ `string` | `RegExp`
262
+
237
263
  #### Returns
238
264
 
239
265
  `boolean`
@@ -254,14 +280,18 @@ Test to see if any of the errors or children have the given error name.
254
280
 
255
281
  #### Parameters
256
282
 
257
- **error**: `unknown`
283
+ ##### error
284
+
285
+ `unknown`
258
286
 
259
287
  The error to test.
260
288
 
261
- **name**: `string` \| `RegExp`
289
+ ##### name
262
290
 
263
291
  The name to check for.
264
292
 
293
+ `string` | `RegExp`
294
+
265
295
  #### Returns
266
296
 
267
297
  `error is BaseError`
@@ -282,14 +312,18 @@ Test to see if any of the errors or children have the given error message.
282
312
 
283
313
  #### Parameters
284
314
 
285
- **error**: `unknown`
315
+ ##### error
316
+
317
+ `unknown`
286
318
 
287
319
  The error to test.
288
320
 
289
- **message**: `string` \| `RegExp`
321
+ ##### message
290
322
 
291
323
  The message to check for.
292
324
 
325
+ `string` | `RegExp`
326
+
293
327
  #### Returns
294
328
 
295
329
  `error is BaseError`
@@ -310,11 +344,15 @@ Test to see if any of the errors or children are from a specific class.
310
344
 
311
345
  #### Parameters
312
346
 
313
- **error**: `unknown`
347
+ ##### error
348
+
349
+ `unknown`
314
350
 
315
351
  The error to test.
316
352
 
317
- **cls**: `string`
353
+ ##### cls
354
+
355
+ `string`
318
356
 
319
357
  The class to check for.
320
358
 
@@ -338,14 +376,18 @@ Test to see if any of the errors or children have the given error code.
338
376
 
339
377
  #### Parameters
340
378
 
341
- **error**: `unknown`
379
+ ##### error
380
+
381
+ `unknown`
342
382
 
343
383
  The error to test.
344
384
 
345
- **code**: `string` \| `RegExp`
385
+ ##### code
346
386
 
347
387
  The code to check for.
348
388
 
389
+ `string` | `RegExp`
390
+
349
391
  #### Returns
350
392
 
351
393
  `error is BaseError`