An open API service indexing awesome lists of open source software.

https://github.com/hrsh7th/js-modelis-assurance

assucrance plugin for modelis.
https://github.com/hrsh7th/js-modelis-assurance

Last synced: 8 months ago
JSON representation

assucrance plugin for modelis.

Awesome Lists containing this project

README

          

modelis-assurance
===============

assurance plugin for modelis.

### [assurance](http://github.com/danmilon/assurance)

#### Export API

- Modelised#assurance

#### Option

- ```attrOptionKey``` (optional, default=assurance)
- key name for plug-in to see attribute's option.

#### Example

##### use.

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