mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-10 19:39:17 +00:00
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…
Reference in New Issue
Block a user