Skip to content
Malexion edited this page Jan 13, 2017 · 1 revision

new __.lib.Model(defaults)

Class that generates an object templating engine allowing you to create objects off of a base set of defaults.

Examples

var User = new __.lib.Model({
   name: '',
   pass: '',
   age: 1,
   log: function() {
      console.log(this); // this context bound to instance created
   }
});

User.create({ name: 'frank' }).log();

var users = User.all([ { name: 'sue', age: 20 }, { name: 'joe', pass: 'hall', age: 52 } ]);
__.all(users, user => user.log());