@juanaragon-co/transformer
v0.0.1-beta.0
Published
Utility class for transforming JS objects
Readme
Transformer - Juan Aragon CO
Utility library for transforming dict objects into typed domain data
Installation
yarn add @juanaragon-co/transformer dayjs
npm install juanaragon-co/transformer dayjsUsage
import { t } from '@juanaragon-co/transformer';
const transformer = t.object({
name: t.string('user.name'),
age: t.number('user.age'),
email: t.string('user.email', {defaultValue: '[email protected]'}),
});
/* {
* "name": "John Doe",
* "age": 23,
* "email": "[email protected]"
* }
*/
const result = transformer.transform({
user: {
name: 'John Doe',
age: '23',
}
});
