Closed agarzola closed 6 years ago
This PR implements a toObject() method that returns a vanilla Object following the schema for the object’s CustomModel.
toObject()
Object
CustomModel
Given the following CustomModel:
const Model = require('jsonmonger').Model; const Author = new Model({ name: 'attributes.full_name', books: 'relationships.authored_works', topics: 'relationships.authored_categories', influences: 'relationships.influences', });
And given the following code:
const china = new Author({ name: 'China Miéville', }); console.log(china.toObject());
The console should read:
{ name: "China Miéville" }
This PR implements a
toObject()
method that returns a vanillaObject
following the schema for the object’sCustomModel
.Given the following
CustomModel
:And given the following code:
The console should read: