modelis-assurance
v0.0.2
Published
assurance plugin for modelis.
Downloads
6
Readme
modelis-assurance
assurance plugin for modelis.
assurance
Export API
- Modelised#assurance
Option
attrOptionKey
(optional, default=assurance)- key name for plug-in to see attribute's option.
Example
use.
var Modelis = require('modelis');
var assurance = require('modelis-assurance');
if (simple) {
// define.
var User = Modelis.define('User').attr('name', { assurance: { is: 'string' }});
// use.
User.use(assurance());
// User#assurance is available.
new User({}).assurance();
}
if (customize) {
// define.
var User = Modelis.define('User').attr('name', { validate: { is: 'string' }});
// use.
User.use(assurance({
attrOptionKey: 'validate'
}, function(assurance) {
this; //=> User.
this.prototype.validate = assurance;
}));
// User#validate is available.
new User({}).validate();
}