@dwtechs/antity 0.12.0 → 0.13.0
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.
- package/README.md +7 -7
- package/dist/antity.d.ts +1 -0
- package/dist/antity.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://opensource.org/licenses/MIT)
|
|
3
3
|
[](https://www.npmjs.com/package/@dwtechs/antity)
|
|
4
4
|
[](https://www.npmjs.com/package/@dwtechs/antity)
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
- [Synopsis](#synopsis)
|
|
8
8
|
- [Support](#support)
|
|
@@ -364,15 +364,15 @@ Any of these can be passed into the options object for each function.
|
|
|
364
364
|
| type | Type | Type of the property |
|
|
365
365
|
| min | number \| Date | Minimum value | 0 \| 1900-01-01
|
|
366
366
|
| max | number \| Date | Maximum value | 999999999 \| 2200-12-31
|
|
367
|
-
| required | boolean |
|
|
368
|
-
| safe | boolean |
|
|
369
|
-
| typeCheck | boolean | Type is checked
|
|
370
|
-
| methods | Method[] |
|
|
367
|
+
| required | boolean | Property is required during validation | false
|
|
368
|
+
| safe | boolean | Property is sent in the response | true
|
|
369
|
+
| typeCheck | boolean | Type is checked during validation | false
|
|
370
|
+
| methods | Method[] | property is validated for the listed methods only | [ "GET", "POST", "PUT", "DELETE" ]
|
|
371
371
|
| sanitize | boolean | Sanitize the property if true | true
|
|
372
372
|
| normalize | boolean | Normalize the property if true | false
|
|
373
373
|
| validate | boolean | validate the property if true | true
|
|
374
|
-
| sanitizer | ((v:any) => any) \| null |
|
|
375
|
-
| normalizer | ((v:any) => any) \| null | Normalizer function if normalize is true
|
|
374
|
+
| sanitizer | ((v:any) => any) \| null | Custom sanitizer function if sanitize is true | null
|
|
375
|
+
| normalizer | ((v:any) => any) \| null | Custop Normalizer function if normalize is true | null
|
|
376
376
|
| validator | ((v:any, min:number, max:number, typeCheck:boolean) => any) \| null | validator function if validate is true | null
|
|
377
377
|
|
|
378
378
|
* *Min and max parameters are not used for boolean type*
|
package/dist/antity.d.ts
CHANGED
package/dist/antity.js
CHANGED
|
@@ -348,6 +348,7 @@ class Entity {
|
|
|
348
348
|
this._unsafeProps = [];
|
|
349
349
|
for (const p of properties) {
|
|
350
350
|
const prop = new Property(p.key, p.type, p.min, p.max, p.required, p.safe, p.typeCheck, p.methods, p.sanitize, p.normalize, p.validate, p.sanitizer, p.normalizer, p.validator);
|
|
351
|
+
Object.assign(prop, p);
|
|
351
352
|
this._properties.push(prop);
|
|
352
353
|
if (!prop.safe)
|
|
353
354
|
this._unsafeProps.push(prop.key);
|