From ed41c518509ee3d8159284ceb269f6e36d32e3c2 Mon Sep 17 00:00:00 2001 From: Michael Schoonmaker Date: Thu, 27 Sep 2012 11:26:56 -0700 Subject: [PATCH] Updated Memory.merge to handle null values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, if the Memory store was merged with an object containing a null value, the following Error occurred: TypeError: Object.keys called on non-object     at Function.keys (native)     at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:17)     at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:200:17)     at Array.every (native)     at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:29)     at common.merge (/.../node_modules/nconf/lib/nconf/common.js:99:13)     at Array.forEach (native)     at common.merge (/.../node_modules/nconf/lib/nconf/common.js:98:22)     at Array.forEach (native)     at Object.common.merge (/.../node_modules/nconf/lib/nconf/common.js:97:8) This commit prevents that. --- lib/nconf/stores/memory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nconf/stores/memory.js b/lib/nconf/stores/memory.js index b53ac12..215953c 100644 --- a/lib/nconf/stores/memory.js +++ b/lib/nconf/stores/memory.js @@ -157,7 +157,7 @@ Memory.prototype.merge = function (key, value) { // If the key is not an `Object` or is an `Array`, // then simply set it. Merging is for Objects. // - if (typeof value !== 'object' || Array.isArray(value)) { + if (typeof value !== 'object' || Array.isArray(value) || value === null) { return this.set(key, value); }