add forgotten validate params module
This commit is contained in:
parent
969e3633f2
commit
e89211ab72
19
lib/validateParams.js
Normal file
19
lib/validateParams.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var conform = require('conform'),
|
||||||
|
_ = require('underscore');
|
||||||
|
|
||||||
|
module.exports = function(params, schema, validateOptions) {
|
||||||
|
var defaultValidateOptions = {
|
||||||
|
additionalProperties: true,
|
||||||
|
failOnFirstError: true,
|
||||||
|
cast: true,
|
||||||
|
castSource: true,
|
||||||
|
applyDefaultValue: true
|
||||||
|
};
|
||||||
|
|
||||||
|
conform.validate(params, schema, _({}).extend(
|
||||||
|
defaultValidateOptions, validateOptions
|
||||||
|
));
|
||||||
|
return params;
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user