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

Commit 7a8e9022 by Sascha Depold

parameter validator can handle custom deprecation warnings

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