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.
- Host: GitHub
- URL: https://github.com/hrsh7th/js-modelis-assurance
- Owner: hrsh7th
- Created: 2014-06-03T13:17:49.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-17T14:34:46.000Z (over 11 years ago)
- Last Synced: 2025-02-12T21:05:31.350Z (8 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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();
}
```