Introduction
Library for data adaptation using decorators. You can declaratively state how your data should look when being send to the server.
How to use?
npm install data-adapter
Example
Using class adapter
; // { first_name: 'foo', last_name: 'bar', age: 42 }denormalizenew Human; // { firstName: 'foo', lastName: 'bar', age: 42 }normalize, Human;
Using property adapters
; ; ; ;parent.firstName = 'John';parent.lastName = 'Doe'; ;kid1.gender = 'male';;kid2.gender = 'female'; // { first_name: 'John', last_name: 'Doe', kids: [{ gender: 0 }, { gender: 1 }] }; // { firstName: 'John', lastName: 'Doe', kids: [{ gender: 'male' }, { gender: 'female' }] };
License
MIT