From c7aaee6dbc01b56cc35f0246174075146b3ecaa9 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Thu, 10 Aug 2017 16:50:12 -0500 Subject: [PATCH] Changed let scope, added undefined check. --- examples/proxy/proxy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/proxy/proxy.js b/examples/proxy/proxy.js index a0671a3..4694bab 100644 --- a/examples/proxy/proxy.js +++ b/examples/proxy/proxy.js @@ -41,7 +41,8 @@ let printAllNames = false; const printNameWhitelist = {}; const printNameBlacklist = {}; (function() { - for(let i = 0; i < args.length; i++) { + let i = 0; + for(i = 0; i < args.length; i++) { const option = args[i]; if(!/^-/.test(option)) break; if(option === "--dump-all") { @@ -180,6 +181,6 @@ function shouldDump(name, direction) { return matches(printNameWhitelist[name]); function matches(result) { - return result !== null && result.indexOf(direction) !== -1; + return result !== undefined && result !== null && result.indexOf(direction) !== -1; } }