Skip to content

Commit

Permalink
[fix] Fix regression introduced by 36e061c
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Jul 10, 2012
1 parent 7e8d9d6 commit d96d254
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions lib/nconf/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion test/provider-save-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit d96d254

Please sign in to comment.