View Code? Open in Web Editor
NEW
Decorator-based utility for transformation (serialization/deserialization) between plain object and class instance, developed for TypeScript projects. An alternative to class-validator and class-transformer.
Home Page: https://www.npmjs.com/package/@yamamotok/dataobject
License: MIT License
JavaScript 2.39%
TypeScript 97.61%
dataobject's People
Contributors
Stargazers
Watchers
dataobject's Issues
Currently validation is applied before transformation, however I think it should be applied in process of transformation.
undefined
should be ignored and no need to apply validation (currently validation is before undefined check)
It should be after custom transformer because usually a custom transformer has its own validation and type conversion.
While "dataobject" has implicit type coercion for primitive types (string, number, and boolean), a validator function to be set looks like this.
( value : unknown ) => isLength ( String ( value ) , { max : 100 } )
I think it would be nice if the type coerced value is passed to validation function.
( value : string ) => isLength ( value , { max : 100 } )
v1.1.0 will be released in a couple of weeks.