modelis-assurance

0.0.2 • Public • Published

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();
}

Package Sidebar

Install

npm i modelis-assurance

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • hrsh7th