You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,8 @@ Manages an [`Error`][js-error] of validation.
195
195
196
196
![update]
197
197
198
+
[2.0.0]: Uses static private property `#template` and guards the value with private static method `#guardTemplate()` to be `string` type that contains `[fix]` and `[problem]` words.
199
+
198
200
A template of the error message guarded by [`string`][js-string] type with the replaceable `[problem]` and `[fix]` words. By default, it's set to `Problem: [problem] => Fix: [fix]`. It can be set directly or by the [`setTemplate()`][error-method-settemplate] and [`setMessage()`][error-method-setmessage] method. The value is being checked against the existence of `[problem]` and `[fix]` words.
199
201
200
202
```typescript
@@ -218,6 +220,8 @@ static set template(value: string) {
218
220
219
221
![update]
220
222
223
+
[2.0.0]: Uses static private property `#fix` and guards the value to be a [`string`][js-string] type.
224
+
221
225
A possible solution to the described [`problem`][error-property-problem] of validation that is guarded by a [`string`][js-string] type. By default, it's an empty [`string`][js-string]. It can be set directly or by the [`setFix()`][error-method-setfix] and [`setMessage()`][error-method-setmessage] method.
222
226
223
227
```typescript
@@ -235,6 +239,8 @@ public set fix(value: string) {
235
239
236
240
![update]
237
241
242
+
[2.0.0]: Uses inherited from `Error` property and guards the value to be a [`string`][js-string] type.
243
+
238
244
A validation error message guarded by a [`string`][js-string] type that can be build from the [`problem`][error-property-problem] and [`fix`][error-property-fix] of [`ValidationError`](#validationerror) on the [`template`][error-property-template]. It can be set directly or by the [`throw()`][error-method-throw] and [`setMessage()`][error-method-setmessage] method.
239
245
240
246
```typescript
@@ -283,6 +289,8 @@ public set problem(value: string) {
283
289
284
290
![update]
285
291
292
+
[2.0.0]: Adds template to the provided `message` instead of separate parameter and guards it with a static `#guardMessage()` method.
293
+
286
294
Defines the validation error message of a [`string`][js-string] type from the provided `message` of the [`ErrorMessage`](#errormessage) interface.
[2.0.0]: Adds template to the provided `message` instead of separate parameter and uses a new method [`setMessage()`][error-method-setmessage] to set message. Handle the callback for all instance methods with the callback parameter.
413
+
404
414
Creates a new instance with the message. If the provided `message` is an [`object`][js-object], then its properties are assigned to the instance.
405
415
406
416
```typescript
@@ -963,6 +973,10 @@ addPerson({
963
973
964
974
#### `ErrorMessage`
965
975
976
+
![update]
977
+
978
+
[2.0.0]: Adds an optional `template` property.
979
+
966
980
The shape of an [`object`][js-object] for an [`error`][js-error] message that contains a possible solution to the described problem.
967
981
968
982
```typescript
@@ -982,6 +996,7 @@ Possible solution to the described problem of a [`string`][js-string] type.
982
996
Description of validation problem of a [`string`][js-string] type.
983
997
984
998
**`template?: string`**
999
+
![new]
985
1000
An optional message template of a [`string`][js-string] type.
0 commit comments