- Validate data type and data structure.
- Translate data type.
yarn install # Dependecies
yarn run dev # Dev
yarn run build # Build
yarn run test # Test
npm install data-reviser
# or
yarn add data-reviser
import { Reviser, TypeInt32, ToInt32 } from 'data-reviser';
class M extends Reviser {
@ToInt32
@TypeInt32()
num = 1;
};
const m = new M();
const message = m.set({ num: '123'});
console.log(message); // { num: { type: string, message: string }}
console.log(m.get()); // { num: 123 }
class N extends M {
@ToInt32
str = '';
};
const n = new N();
const message = m.set({ str: 123 });
console.log(message); // null
console.log(m.get()); // { num: 1, str: '123'}
More example see test case.
TODO