@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,245 @@
1
+ import type { IValidationFailure } from "../models/IValidationFailure";
2
+ /**
3
+ * Class to handle validation operations.
4
+ */
5
+ export declare class Validation {
6
+ /**
7
+ * Is the property null or undefined.
8
+ * @param property The name of the property.
9
+ * @param value The value to test.
10
+ * @param failures The list of failures to add to.
11
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
12
+ * @returns True if the value is a empty.
13
+ */
14
+ static empty(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is undefined | null;
15
+ /**
16
+ * Is the property is not null or undefined.
17
+ * @param property The name of the property.
18
+ * @param value The value to test.
19
+ * @param failures The list of failures to add to.
20
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
21
+ * @returns True if the value is a not empty.
22
+ */
23
+ static notEmpty(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): boolean;
24
+ /**
25
+ * Is the property a string.
26
+ * @param property The name of the property.
27
+ * @param value The value to test.
28
+ * @param failures The list of failures to add to.
29
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
30
+ * @param options Additional options for the validation.
31
+ * @param options.minLength The minimum length of the string.
32
+ * @param options.maxLength The maximum length of the string.
33
+ * @returns True if the value is a valid string.
34
+ */
35
+ static string(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
36
+ minLength?: number;
37
+ maxLength?: number;
38
+ }): value is string;
39
+ /**
40
+ * Is the property a string with a value.
41
+ * @param property The name of the property.
42
+ * @param value The value to test.
43
+ * @param failures The list of failures to add to.
44
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
45
+ * @param options Additional options for the validation.
46
+ * @param options.minLength The minimum length of the string.
47
+ * @param options.maxLength The maximum length of the string.
48
+ * @returns True if the value is a valid string.
49
+ */
50
+ static stringValue(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
51
+ minLength?: number;
52
+ maxLength?: number;
53
+ }): value is string;
54
+ /**
55
+ * Is the property a number.
56
+ * @param property The name of the property.
57
+ * @param value The value to test.
58
+ * @param failures The list of failures to add to.
59
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
60
+ * @param options Additional options for the validation.
61
+ * @param options.minValue The minimum value of the number.
62
+ * @param options.maxValue The maximum value of the number.
63
+ * @returns True if the value is a valid number.
64
+ */
65
+ static number(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
66
+ minValue?: number;
67
+ maxValue?: number;
68
+ }): value is number;
69
+ /**
70
+ * Is the property an integer.
71
+ * @param property The name of the property.
72
+ * @param value The value to test.
73
+ * @param failures The list of failures to add to.
74
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
75
+ * @param options Additional options for the validation.
76
+ * @param options.minValue The minimum value of the integer.
77
+ * @param options.maxValue The maximum value of the integer.
78
+ * @returns True if the value is a valid integer.
79
+ */
80
+ static integer(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
81
+ minValue?: number;
82
+ maxValue?: number;
83
+ }): value is number;
84
+ /**
85
+ * Is the property a bigint.
86
+ * @param property The name of the property.
87
+ * @param value The value to test.
88
+ * @param failures The list of failures to add to.
89
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
90
+ * @param options Additional options for the validation.
91
+ * @param options.minValue The minimum value of the bigint.
92
+ * @param options.maxValue The maximum value of the bigint.
93
+ * @returns True if the value is a valid bigint.
94
+ */
95
+ static bigint(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string, options?: {
96
+ minValue?: bigint;
97
+ maxValue?: bigint;
98
+ }): value is bigint;
99
+ /**
100
+ * Is the property a boolean.
101
+ * @param property The name of the property.
102
+ * @param value The value to test.
103
+ * @param failures The list of failures to add to.
104
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
105
+ * @returns True if the value is a boolean.
106
+ */
107
+ static boolean(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is boolean;
108
+ /**
109
+ * Is the property a date.
110
+ * @param property The name of the property.
111
+ * @param value The value to test.
112
+ * @param failures The list of failures to add to.
113
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
114
+ * @returns True if the value is a date.
115
+ */
116
+ static date(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is Date;
117
+ /**
118
+ * Is the property a date in ISO 8601 format.
119
+ * @param property The name of the property.
120
+ * @param value The value to test.
121
+ * @param failures The list of failures to add to.
122
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
123
+ * @returns True if the value is a date.
124
+ */
125
+ static dateString(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
126
+ /**
127
+ * Is the property a date/time in ISO 8601 format.
128
+ * @param property The name of the property.
129
+ * @param value The value to test.
130
+ * @param failures The list of failures to add to.
131
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
132
+ * @returns True if the value is a date/time.
133
+ */
134
+ static dateTimeString(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
135
+ /**
136
+ * Is the property a time in ISO 8601 format.
137
+ * @param property The name of the property.
138
+ * @param value The value to test.
139
+ * @param failures The list of failures to add to.
140
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
141
+ * @returns True if the value is a time.
142
+ */
143
+ static timeString(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
144
+ /**
145
+ * Is the property a timestamp in milliseconds.
146
+ * @param property The name of the property.
147
+ * @param value The value to test.
148
+ * @param failures The list of failures to add to.
149
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
150
+ * @returns True if the value is a timestamp in milliseconds.
151
+ */
152
+ static timestampMilliseconds(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is number;
153
+ /**
154
+ * Is the property a timestamp in seconds.
155
+ * @param property The name of the property.
156
+ * @param value The value to test.
157
+ * @param failures The list of failures to add to.
158
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
159
+ * @returns True if the value is a timestamp in seconds.
160
+ */
161
+ static timestampSeconds(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is number;
162
+ /**
163
+ * Is the property an object.
164
+ * @param property The name of the property.
165
+ * @param value The value to test.
166
+ * @param failures The list of failures to add to.
167
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
168
+ * @returns True if the value is a object.
169
+ */
170
+ static object<T = {
171
+ [id: string]: unknown;
172
+ }>(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is T;
173
+ /**
174
+ * Is the property an array.
175
+ * @param property The name of the property.
176
+ * @param value The value to test.
177
+ * @param failures The list of failures to add to.
178
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
179
+ * @returns True if the value is an array.
180
+ */
181
+ static array<T>(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is T[];
182
+ /**
183
+ * Is the property an array with at least one item.
184
+ * @param property The name of the property.
185
+ * @param value The value to test.
186
+ * @param failures The list of failures to add to.
187
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
188
+ * @returns True if the value is an array with at least one element.
189
+ */
190
+ static arrayValue<T>(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is T[];
191
+ /**
192
+ * Is the property one of a list of items.
193
+ * @param property The name of the property.
194
+ * @param value The value to test.
195
+ * @param options The options the value must be one of.
196
+ * @param failures The list of failures to add to.
197
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
198
+ * @returns True if the value is one of the items in the options.
199
+ */
200
+ static arrayOneOf<T>(property: string, value: T, options: T[], failures: IValidationFailure[], fieldNameResource?: string): value is T;
201
+ /**
202
+ * Is the property a Uint8Array.
203
+ * @param property The name of the property.
204
+ * @param value The value to test.
205
+ * @param failures The list of failures to add to.
206
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
207
+ * @returns True if the value is a Uint8Array.
208
+ */
209
+ static uint8Array(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is Uint8Array;
210
+ /**
211
+ * Is the property valid JSON.
212
+ * @param property The name of the property.
213
+ * @param value The value to test.
214
+ * @param failures The list of failures to add to.
215
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
216
+ * @returns True if the value is valid JSON.
217
+ */
218
+ static json(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
219
+ /**
220
+ * Is the property a string in e-mail format.
221
+ * @param property The name of the property.
222
+ * @param value The value to test.
223
+ * @param failures The list of failures to add to.
224
+ * @param fieldNameResource Optional i18n resource of the field name to display in the message.
225
+ * @returns True if the value is a valid looking e-mail.
226
+ */
227
+ static email(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
228
+ /**
229
+ * Throw the validation failures as a ValidationError.
230
+ * @param source The source of the error.
231
+ * @param objectName The object that was being validated.
232
+ * @param failures The validation failures.
233
+ * @throws ValidationError From the converted failures.
234
+ */
235
+ static asValidationError(source: string, objectName: string, failures: IValidationFailure[]): void;
236
+ /**
237
+ * Map a list of failures to their properties in a map.
238
+ * @param failures The validation failures to combine into the map for the properties.
239
+ * @param propertyMap The map to add the failures to.
240
+ * @param clearMap Should the map be cleared before adding the failures.
241
+ */
242
+ static toPropertyMap(failures: IValidationFailure[], propertyMap: {
243
+ [property: string]: IValidationFailure[];
244
+ }, clearMap?: boolean): void;
245
+ }
@@ -0,0 +1,5 @@
1
+ # @twin.org/core - Changelog
2
+
3
+ ## v0.0.1
4
+
5
+ - Initial Release
@@ -0,0 +1 @@
1
+ # @twin.org/core - Examples
@@ -0,0 +1,375 @@
1
+ # Class: AlreadyExistsError
2
+
3
+ Class to handle errors which are triggered by data already existing.
4
+
5
+ ## Extends
6
+
7
+ - [`BaseError`](BaseError.md)
8
+
9
+ ## Constructors
10
+
11
+ ### new AlreadyExistsError()
12
+
13
+ > **new AlreadyExistsError**(`source`, `message`, `existingId`?, `inner`?): [`AlreadyExistsError`](AlreadyExistsError.md)
14
+
15
+ Create a new instance of AlreadyExistsError.
16
+
17
+ #### Parameters
18
+
19
+ • **source**: `string`
20
+
21
+ The source of the error.
22
+
23
+ • **message**: `string`
24
+
25
+ The message as a code.
26
+
27
+ • **existingId?**: `string`
28
+
29
+ The id for the item.
30
+
31
+ • **inner?**: `unknown`
32
+
33
+ The inner error if we have wrapped another error.
34
+
35
+ #### Returns
36
+
37
+ [`AlreadyExistsError`](AlreadyExistsError.md)
38
+
39
+ #### Overrides
40
+
41
+ [`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructors)
42
+
43
+ ## Properties
44
+
45
+ ### CLASS\_NAME
46
+
47
+ > `readonly` `static` **CLASS\_NAME**: `string`
48
+
49
+ Runtime name for the class.
50
+
51
+ ***
52
+
53
+ ### source?
54
+
55
+ > `optional` **source**: `string`
56
+
57
+ The source of the error.
58
+
59
+ #### Inherited from
60
+
61
+ [`BaseError`](BaseError.md).[`source`](BaseError.md#source)
62
+
63
+ ***
64
+
65
+ ### properties?
66
+
67
+ > `optional` **properties**: `object`
68
+
69
+ Any additional information for the error.
70
+
71
+ #### Index Signature
72
+
73
+ \[`id`: `string`\]: `unknown`
74
+
75
+ #### Inherited from
76
+
77
+ [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties)
78
+
79
+ ***
80
+
81
+ ### inner?
82
+
83
+ > `optional` **inner**: [`IError`](../interfaces/IError.md)
84
+
85
+ The inner error if there was one.
86
+
87
+ #### Inherited from
88
+
89
+ [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
90
+
91
+ ## Methods
92
+
93
+ ### fromError()
94
+
95
+ > `static` **fromError**(`err`): [`BaseError`](BaseError.md)
96
+
97
+ Construct an error from an existing one.
98
+
99
+ #### Parameters
100
+
101
+ • **err**: `unknown`
102
+
103
+ The existing error.
104
+
105
+ #### Returns
106
+
107
+ [`BaseError`](BaseError.md)
108
+
109
+ The new instance.
110
+
111
+ #### Inherited from
112
+
113
+ [`BaseError`](BaseError.md).[`fromError`](BaseError.md#fromerror)
114
+
115
+ ***
116
+
117
+ ### flatten()
118
+
119
+ > `static` **flatten**(`err`): [`IError`](../interfaces/IError.md)[]
120
+
121
+ Flatten an error tree.
122
+
123
+ #### Parameters
124
+
125
+ • **err**: `unknown`
126
+
127
+ The starting error.
128
+
129
+ #### Returns
130
+
131
+ [`IError`](../interfaces/IError.md)[]
132
+
133
+ The list of all internal errors.
134
+
135
+ #### Inherited from
136
+
137
+ [`BaseError`](BaseError.md).[`flatten`](BaseError.md#flatten)
138
+
139
+ ***
140
+
141
+ ### expand()
142
+
143
+ > `static` **expand**(`errors`): `undefined` \| [`IError`](../interfaces/IError.md)
144
+
145
+ Expand an error tree.
146
+
147
+ #### Parameters
148
+
149
+ • **errors**: `undefined` \| [`IError`](../interfaces/IError.md)[]
150
+
151
+ The list of errors to expand.
152
+
153
+ #### Returns
154
+
155
+ `undefined` \| [`IError`](../interfaces/IError.md)
156
+
157
+ The first level error.
158
+
159
+ #### Inherited from
160
+
161
+ [`BaseError`](BaseError.md).[`expand`](BaseError.md#expand)
162
+
163
+ ***
164
+
165
+ ### isErrorName()
166
+
167
+ > `static` **isErrorName**(`error`, `name`): `error is BaseError`
168
+
169
+ Test to see if the error has the specified error name.
170
+
171
+ #### Parameters
172
+
173
+ • **error**: `unknown`
174
+
175
+ The error to test.
176
+
177
+ • **name**: `string` \| `RegExp`
178
+
179
+ The name to check for.
180
+
181
+ #### Returns
182
+
183
+ `error is BaseError`
184
+
185
+ True if the error has the name.
186
+
187
+ #### Inherited from
188
+
189
+ [`BaseError`](BaseError.md).[`isErrorName`](BaseError.md#iserrorname)
190
+
191
+ ***
192
+
193
+ ### isErrorMessage()
194
+
195
+ > `static` **isErrorMessage**(`error`, `message`): `error is BaseError`
196
+
197
+ Test to see if the error has the specified error message.
198
+
199
+ #### Parameters
200
+
201
+ • **error**: `unknown`
202
+
203
+ The error to test.
204
+
205
+ • **message**: `string` \| `RegExp`
206
+
207
+ The message to check for.
208
+
209
+ #### Returns
210
+
211
+ `error is BaseError`
212
+
213
+ True if the error has the name.
214
+
215
+ #### Inherited from
216
+
217
+ [`BaseError`](BaseError.md).[`isErrorMessage`](BaseError.md#iserrormessage)
218
+
219
+ ***
220
+
221
+ ### isErrorCode()
222
+
223
+ > `static` **isErrorCode**(`error`, `code`): `boolean`
224
+
225
+ Test to see if the error has the specified error code.
226
+
227
+ #### Parameters
228
+
229
+ • **error**: `unknown`
230
+
231
+ The error to test.
232
+
233
+ • **code**: `string` \| `RegExp`
234
+
235
+ The code to check for.
236
+
237
+ #### Returns
238
+
239
+ `boolean`
240
+
241
+ True if the error has the code.
242
+
243
+ #### Inherited from
244
+
245
+ [`BaseError`](BaseError.md).[`isErrorCode`](BaseError.md#iserrorcode)
246
+
247
+ ***
248
+
249
+ ### someErrorName()
250
+
251
+ > `static` **someErrorName**(`error`, `name`): `error is BaseError`
252
+
253
+ Test to see if any of the errors or children have the given error name.
254
+
255
+ #### Parameters
256
+
257
+ • **error**: `unknown`
258
+
259
+ The error to test.
260
+
261
+ • **name**: `string` \| `RegExp`
262
+
263
+ The name to check for.
264
+
265
+ #### Returns
266
+
267
+ `error is BaseError`
268
+
269
+ True if the error has the name.
270
+
271
+ #### Inherited from
272
+
273
+ [`BaseError`](BaseError.md).[`someErrorName`](BaseError.md#someerrorname)
274
+
275
+ ***
276
+
277
+ ### someErrorMessage()
278
+
279
+ > `static` **someErrorMessage**(`error`, `message`): `error is BaseError`
280
+
281
+ Test to see if any of the errors or children have the given error message.
282
+
283
+ #### Parameters
284
+
285
+ • **error**: `unknown`
286
+
287
+ The error to test.
288
+
289
+ • **message**: `string` \| `RegExp`
290
+
291
+ The message to check for.
292
+
293
+ #### Returns
294
+
295
+ `error is BaseError`
296
+
297
+ True if the error has the name.
298
+
299
+ #### Inherited from
300
+
301
+ [`BaseError`](BaseError.md).[`someErrorMessage`](BaseError.md#someerrormessage)
302
+
303
+ ***
304
+
305
+ ### someErrorClass()
306
+
307
+ > `static` **someErrorClass**(`error`, `cls`): `error is BaseError`
308
+
309
+ Test to see if any of the errors or children are from a specific class.
310
+
311
+ #### Parameters
312
+
313
+ • **error**: `unknown`
314
+
315
+ The error to test.
316
+
317
+ • **cls**: `string`
318
+
319
+ The class to check for.
320
+
321
+ #### Returns
322
+
323
+ `error is BaseError`
324
+
325
+ True if the error has the specific class.
326
+
327
+ #### Inherited from
328
+
329
+ [`BaseError`](BaseError.md).[`someErrorClass`](BaseError.md#someerrorclass)
330
+
331
+ ***
332
+
333
+ ### someErrorCode()
334
+
335
+ > `static` **someErrorCode**(`error`, `code`): `error is BaseError`
336
+
337
+ Test to see if any of the errors or children have the given error code.
338
+
339
+ #### Parameters
340
+
341
+ • **error**: `unknown`
342
+
343
+ The error to test.
344
+
345
+ • **code**: `string` \| `RegExp`
346
+
347
+ The code to check for.
348
+
349
+ #### Returns
350
+
351
+ `error is BaseError`
352
+
353
+ True if the error has the name.
354
+
355
+ #### Inherited from
356
+
357
+ [`BaseError`](BaseError.md).[`someErrorCode`](BaseError.md#someerrorcode)
358
+
359
+ ***
360
+
361
+ ### toJsonObject()
362
+
363
+ > **toJsonObject**(): [`IError`](../interfaces/IError.md)
364
+
365
+ Serialize the error to the error model.
366
+
367
+ #### Returns
368
+
369
+ [`IError`](../interfaces/IError.md)
370
+
371
+ The error model.
372
+
373
+ #### Inherited from
374
+
375
+ [`BaseError`](BaseError.md).[`toJsonObject`](BaseError.md#tojsonobject)
@@ -0,0 +1,37 @@
1
+ # Class: ArrayHelper
2
+
3
+ Class to help with arrays.
4
+
5
+ ## Constructors
6
+
7
+ ### new ArrayHelper()
8
+
9
+ > **new ArrayHelper**(): [`ArrayHelper`](ArrayHelper.md)
10
+
11
+ #### Returns
12
+
13
+ [`ArrayHelper`](ArrayHelper.md)
14
+
15
+ ## Methods
16
+
17
+ ### matches()
18
+
19
+ > `static` **matches**(`arr1`, `arr2`): `boolean`
20
+
21
+ Do the two arrays match.
22
+
23
+ #### Parameters
24
+
25
+ • **arr1**: `unknown`
26
+
27
+ The first array.
28
+
29
+ • **arr2**: `unknown`
30
+
31
+ The second array.
32
+
33
+ #### Returns
34
+
35
+ `boolean`
36
+
37
+ True if both arrays are empty of have the same values.