nci/lib/validateParams.js

20 lines
406 B
JavaScript
Raw Normal View History

2015-12-29 20:31:05 +00:00
'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;
};