JSPM

modelis-assurance

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q16590F
  • License MIT

assurance plugin for modelis.

Package Exports

  • modelis-assurance

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (modelis-assurance) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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