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)

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i immutable-struct

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • chemdrew