Skip to content

Commit 3d9f4e2

Browse files
docs(README.md): update.
1 parent 1a85aec commit 3d9f4e2

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ Manages an [`Error`][js-error] of validation.
195195

196196
![update]
197197

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+
198200
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.
199201

200202
```typescript
@@ -218,6 +220,8 @@ static set template(value: string) {
218220

219221
![update]
220222

223+
[2.0.0]: Uses static private property `#fix` and guards the value to be a [`string`][js-string] type.
224+
221225
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.
222226

223227
```typescript
@@ -235,6 +239,8 @@ public set fix(value: string) {
235239

236240
![update]
237241

242+
[2.0.0]: Uses inherited from `Error` property and guards the value to be a [`string`][js-string] type.
243+
238244
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.
239245

240246
```typescript
@@ -283,6 +289,8 @@ public set problem(value: string) {
283289

284290
![update]
285291

292+
[2.0.0]: Adds template to the provided `message` instead of separate parameter and guards it with a static `#guardMessage()` method.
293+
286294
Defines the validation error message of a [`string`][js-string] type from the provided `message` of the [`ErrorMessage`](#errormessage) interface.
287295

288296
```typescript
@@ -401,6 +409,8 @@ const errorMessage = ValidationError.defineMessage(
401409

402410
![update]
403411

412+
[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+
404414
Creates a new instance with the message. If the provided `message` is an [`object`][js-object], then its properties are assigned to the instance.
405415

406416
```typescript
@@ -963,6 +973,10 @@ addPerson({
963973

964974
#### `ErrorMessage`
965975

976+
![update]
977+
978+
[2.0.0]: Adds an optional `template` property.
979+
966980
The shape of an [`object`][js-object] for an [`error`][js-error] message that contains a possible solution to the described problem.
967981

968982
```typescript
@@ -982,6 +996,7 @@ Possible solution to the described problem of a [`string`][js-string] type.
982996
Description of validation problem of a [`string`][js-string] type.
983997

984998
**`template?: string`**
999+
![new]
9851000
An optional message template of a [`string`][js-string] type.
9861001

9871002
<br>

0 commit comments

Comments
 (0)