-congruence
Generate browser-compatible validator functions for Sails.js models. A congruence extension.
Install
$ npm install sails-congruence --save
Usage
Create a validator function from a model, e.g. Account:
var congruence = ;var validateAccount = congruence; var valid = // returns false. 'X' is not a valid account type// https://github.com/tjwebb/xtuple-api/blob/master/api/models/Account.js#L17
API
.getSailsValidator(model)
Generate a Sails.js validator function for the specified model
@param | description |
---|---|
model |
the model to create the validator function for |
@return | description |
Function |
a function that will return true if model is valid, false otherwise |
License
MIT