不要怂,就是干,撸起袖子干!

Commit 7a8e9022 by Sascha Depold

parameter validator can handle custom deprecation warnings

1 parent 5a1e9c57
Showing with 5 additions and 4 deletions
var ParameterValidator = module.exports = {
check: function(value, expectation, options) {
options = Utils._.extend({
throwError: true,
deprecated: false,
onDeprecated: console.log,
throwError: true,
deprecated: false,
deprecationWarning: "Deprecated!",
onDeprecated: function(s){ console.log('DEPRECATION WARNING:', s) },
optional: false
}, options || {})
......@@ -36,7 +37,7 @@ var matchesExpectation = function(value, expectation) {
var validateDeprication = function(value, expectation, options) {
if (options.deprecated) {
if (matchesExpectation(value, options.deprecated)) {
options.onDeprecated("Deprecated!")
options.onDeprecated(options.deprecationWarning)
return true
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!