diff --git a/lib/nconf/stores/memory.js b/lib/nconf/stores/memory.js index db71387..52c3429 100644 --- a/lib/nconf/stores/memory.js +++ b/lib/nconf/stores/memory.js @@ -44,7 +44,7 @@ Memory.prototype.get = function (key) { // while (path.length > 0) { key = path.shift(); - if (target && target.hasOwnProperty(key)) { + if (target && typeof target !== 'string' && target.hasOwnProperty(key)) { target = target[key]; continue; } diff --git a/test/nconf-test.js b/test/nconf-test.js index dddbabf..76394b8 100644 --- a/test/nconf-test.js +++ b/test/nconf-test.js @@ -67,6 +67,9 @@ vows.describe('nconf').addBatch({ "without a callback": { "should respond with the correct value": function () { assert.equal(nconf.get('foo:bar:bazz'), 'buzz'); + }, + "should not step inside strings": function () { + assert.equal(nconf.get('foo:bar:bazz:0'), undefined); } }, "with a callback": {