@@ -43,6 +43,8 @@ Manages an [`Error`][js-error].
43
43
* [ Api] ( #api )
44
44
* [ ` ValidationError ` ] ( #validationerror )
45
45
* [ Interface] ( #interface )
46
+ * [ Experimental] ( #experimental )
47
+ * [ Changelog] ( #changelog )
46
48
* [ Git] ( #git )
47
49
* [ Commit] ( #commit )
48
50
* [ Versioning] ( #versioning )
@@ -63,13 +65,15 @@ Type guard (constrain)
63
65
Guards
64
66
> It's a ** combination** of both above, ** constrains** the type of the parameter in the ** code editor** , and checks its provided argument.
65
67
66
- Sets
67
- > Sets the existing given value in the ` object ` .
68
-
69
68
Defines
70
- > Returns defined value from the method of the ` object ` .
71
- > Defines the new value in the ` object ` .
72
- > Both above at the same time.
69
+ > Returns defined value from a method of an object.
70
+ > Defines new value in an object and returns a defined value.
71
+
72
+ Gets
73
+ > Returns a value from an object.
74
+
75
+ Sets
76
+ > Adds or updates an element with a specified key and a value to an object and returns an object.
73
77
74
78
<br >
75
79
@@ -110,6 +114,18 @@ import {
110
114
} from ' @angular-package/error' ;
111
115
```
112
116
117
+ ``` typescript
118
+ /*
119
+ * Experimental.
120
+ */
121
+ import {
122
+ // Class.
123
+ MessageBuilder ,
124
+ MessageBuilderTemplate ,
125
+ MessageFunctionBuilder ,
126
+ } from ' @angular-package/error' ;
127
+ ```
128
+
113
129
<br >
114
130
115
131
## ` ValidationError `
@@ -219,7 +235,7 @@ The **return value** is a message of a `string` type created from the provided `
219
235
220
236
``` typescript
221
237
// Example usage.
222
- import { ValidationError } from ' @angular-package/core ' ;
238
+ import { ValidationError } from ' @angular-package/error ' ;
223
239
224
240
const fix = ' There is no solution to the described problem.' ;
225
241
const problem = ' The problem has no solution.' ;
@@ -270,7 +286,7 @@ The **return value** is an instance of [`ValidationError`](#validationerror).
270
286
271
287
``` typescript
272
288
// Example usage.
273
- import { ValidationError } from ' @angular-package/core ' ;
289
+ import { ValidationError } from ' @angular-package/error ' ;
274
290
275
291
const fix = ' There is no solution to the described problem.' ;
276
292
const problem = ' The problem has no solution.' ;
@@ -302,6 +318,108 @@ interface ErrorMessage {
302
318
303
319
<br >
304
320
321
+ ## Experimental
322
+
323
+ ![ experimental]
324
+
325
+ ### Message builder
326
+
327
+ #### ` MessageBuilder `
328
+
329
+ Message builder for error message of a [ ` string ` ] [ js-string ] type.
330
+
331
+ ``` typescript
332
+ // Example usage of building a function.
333
+ import { MessageBuilder } from ' @angular-package/error' ;
334
+
335
+ /**
336
+ * Initialize `MessageBuilder`.
337
+ */
338
+ const messageFunctionBuilder = new MessageBuilder (' function' );
339
+
340
+ messageFunctionBuilder
341
+ .setFunctionName (' guardString' )
342
+ .setParam (' value' , ' string' )
343
+ .setReturn (' boolean' );
344
+
345
+ // Console returns `guardString(value: string): boolean`
346
+ console .log (messageFunctionBuilder .get );
347
+ ```
348
+
349
+ ``` typescript
350
+ // Example usage of building a method.
351
+ import { MessageBuilder } from ' @angular-package/error' ;
352
+
353
+ /**
354
+ * Initialize `MessageBuilder`.
355
+ */
356
+ const messageMethodBuilder = new MessageBuilder (' method' );
357
+
358
+ // Build the class method.
359
+ messageMethodBuilder
360
+ .setMethodName (' setPerson' )
361
+ .setParam (' value' , ' string' )
362
+ .setReturn (' this' );
363
+
364
+ // Console returns `setPerson(value: string): this`
365
+ console .log (messageMethodBuilder .get );
366
+ ```
367
+
368
+ ``` typescript
369
+ // Example usage of building a class.
370
+ import { MessageBuilder } from ' @angular-package/error' ;
371
+
372
+ /**
373
+ * Initialize `MessageBuilder`.
374
+ */
375
+ const messageClassBuilder = new MessageBuilder (' class' );
376
+
377
+ // Build the class.
378
+ messageClassBuilder
379
+ .setClassName (' Person.prototype.' )
380
+ .setMethodName (' setPerson' )
381
+ .setParam (' value?' , ' object' )
382
+ .setReturn (' object' );
383
+
384
+ // Console returns `Person.prototype.setPerson(value?: object): object`
385
+ console .log (messageClassBuilder .get );
386
+ ```
387
+
388
+ <br >
389
+
390
+ #### ` MessageFunctionBuilder `
391
+
392
+ Message function builder for error message of a [ ` string ` ] [ js-string ] type.
393
+
394
+ ``` typescript
395
+ // Example usage of building a function.
396
+ import { MessageFunctionBuilder } from ' @angular-package/error' ;
397
+
398
+ /**
399
+ * Initialize `MessageFunctionBuilder`.
400
+ */
401
+ const messageFunctionBuilder = new MessageFunctionBuilder ();
402
+
403
+ messageFunctionBuilder
404
+ .setName (' guardString' )
405
+ .setParam (' value' , ' string' )
406
+ .setReturn (' boolean' )
407
+ .build ();
408
+
409
+ // Console returns `guardString(value: string): boolean`
410
+ console .log (messageFunctionBuilder .get );
411
+ ```
412
+
413
+ <br >
414
+
415
+ ## Changelog
416
+
417
+ The ** changelog** of this package is based on [ * keep a changelog* ] ( https://keepachangelog.com/en/1.0.0/ ) . To read it, click on the [ CHANGELOG.md] ( https://github.com/angular-package/error/blob/main/CHANGELOG.md ) link.
418
+
419
+ > A changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project. - [ * keep a changelog* ] ( https://keepachangelog.com/en/1.0.0/ )
420
+
421
+ <br >
422
+
305
423
## GIT
306
424
307
425
### Commit
@@ -345,6 +463,7 @@ MIT © angular-package ([license][error-license])
345
463
[ skeleton ] : https://github.com/angular-package/skeleton
346
464
347
465
<!-- Update status -->
466
+ [ experimental ] : https://img.shields.io/badge/-experimental-orange
348
467
[ fix ] : https://img.shields.io/badge/-fix-red
349
468
[ new ] : https://img.shields.io/badge/-new-green
350
469
[ update ] : https://img.shields.io/badge/-update-red
0 commit comments