javascript-jsonapi-model-library

Provide base model to deal with jsonapi models
Installation
$ npm install --save javascript-jsonapi-model-library
Usage
import Model from 'javascript-jsonapi-model-library';
const schema = 'a json-schema';
class Profile extends Model {
constructor(values) {
super(values, schema);
this.setJsonConfig({
attributes: ['name', 'email']
});
}
}
let profile = new Profile({name: 'Simon', email: 'email@example.com', state: 'approved'});
assert(profile.get('name') === 'Simon');
try {
profile.validate();
reply(profile.toJson());
} catch (e) {
}
License
© Simon Paitrault