immutable-struct

0.1.0 • Public • Published

Build Status Coverage Status

here is how you use it

var obj = {
    string: {type: 'string' },
    number: {type: 'number'},
    boolean: {type: 'boolean'},
    enum: {type: 'string', values: ['TEST1', 'TEST2', 'TEST3']},
    array: {type: 'array:string', values: ['test1', 'test2']},
    object: {type: 'object', instanceOf: ParentModel}
}

var Obj = model.create(obj);

var myObj = newObj();

myObj.setNumber(10);
myObj.getNumber(); // returns 10

// or
var myObj = newObj( {string: 'stringInit', number: 20, boolean: false} );

ideally you would have each model in it's own file with module.exports = model.create(obj)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    1

Package Sidebar

Install

npm i immutable-struct

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • chemdrew