From 2bdf7e1a3259a645c211808fcc12bf2e81975415 Mon Sep 17 00:00:00 2001 From: Adrien Becchis Date: Sat, 4 Nov 2017 04:41:23 +0100 Subject: [PATCH] Clean Argv Store options (#290) * unset parse/transform from options and ensure they are not yargs options * use delete rather than undefined assignement --- lib/nconf/stores/argv.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/nconf/stores/argv.js b/lib/nconf/stores/argv.js index b2e13b6..881339a 100644 --- a/lib/nconf/stores/argv.js +++ b/lib/nconf/stores/argv.js @@ -23,8 +23,19 @@ var Argv = exports.Argv = function (options, usage) { this.readOnly = true; this.options = options; this.usage = usage; - this.parseValues = options.parseValues || false; - this.transform = options.transform || false; + if(typeof options.parseValues === 'boolean') { + this.parseValues = options.parseValues; + delete options.parseValues; + } else { + this.parseValues = false; + } + if (typeof options.transform === 'function') { + this.transform = options.transform; + delete options.transform; + } else { + this.transform = false; + } + }; // Inherit from the Memory store