From d96d2544bc0399513160e69ba31b1dfeafbe2ebd Mon Sep 17 00:00:00 2001 From: indexzero Date: Tue, 10 Jul 2012 03:16:54 -0400 Subject: [PATCH] [fix] Fix regression introduced by 36e061c4bda8d79f657dc24b1dcf1937f31d7efe --- lib/nconf/provider.js | 13 ++++++++++--- test/provider-save-test.js | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 438ca5f..e83c3c6 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -460,15 +460,22 @@ Provider.prototype.save = function (value, callback) { // if (store.save) { - store.save(function (err, data) { - if (err) return next(err); + return store.save(function (err, data) { + if (err) { + return next(err); + } + if (typeof data == 'object' && data !== null) { memo.push(data); } + + next(null, memo); }); - } else if (store.saveSync) { + } + else if (store.saveSync) { memo.push(store.saveSync()); } + next(null, memo); } diff --git a/test/provider-save-test.js b/test/provider-save-test.js index 8a30dad..5ca528a 100644 --- a/test/provider-save-test.js +++ b/test/provider-save-test.js @@ -14,7 +14,7 @@ var assert = require('assert'), // require('./mocks/mock-store'); -vows.describe('nconf/provider').addBatch({ +vows.describe('nconf/provider/save').addBatch({ "When using nconf": { "an instance of 'nconf.Provider'": { "with a Mock store": {