From 0bb3f9619f8540736add71962e33590ccfe6a537 Mon Sep 17 00:00:00 2001 From: Tom Yeoman Date: Tue, 20 Feb 2018 02:57:49 +0000 Subject: [PATCH 1/2] Provide warnings for undefined / null options --- node.bittrex.api.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node.bittrex.api.js b/node.bittrex.api.js index 105292e..a8aad0f 100644 --- a/node.bittrex.api.js +++ b/node.bittrex.api.js @@ -64,6 +64,11 @@ var NodeBittrexApi = function(options) { var o = Object.keys(options), i; for (i = 0; i < o.length; i++) { + // Warn about any undefined options we've passed, to avoid strange errors in further calls + if (!options[o[i]]) { + console.error("Warning: You've passed " + options[o[i]] + "for the " + opts[o[i]] + "option, is this intended?") + } + opts[o[i]] = options[o[i]]; } }; From 2fe1319574ac03660edbcebf7d8db600ee1fc074 Mon Sep 17 00:00:00 2001 From: Tom Yeoman Date: Tue, 20 Feb 2018 03:07:30 +0000 Subject: [PATCH 2/2] only catch undefined options --- node.bittrex.api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node.bittrex.api.js b/node.bittrex.api.js index a8aad0f..4183fa7 100644 --- a/node.bittrex.api.js +++ b/node.bittrex.api.js @@ -65,8 +65,8 @@ var NodeBittrexApi = function(options) { i; for (i = 0; i < o.length; i++) { // Warn about any undefined options we've passed, to avoid strange errors in further calls - if (!options[o[i]]) { - console.error("Warning: You've passed " + options[o[i]] + "for the " + opts[o[i]] + "option, is this intended?") + if (options[o[i]] === undefined) { + console.error("Warning: You've passed " + options[o[i]] + " for the " + opts[o[i]] + " option, is this intended?") } opts[o[i]] = options[o[i]];