[fix] Fix regression introduced by 36e061c4bd

This commit is contained in:
indexzero 2012-07-10 03:16:54 -04:00
parent 7e8d9d6bce
commit d96d2544bc
2 changed files with 11 additions and 4 deletions

View file

@ -460,15 +460,22 @@ Provider.prototype.save = function (value, callback) {
// //
if (store.save) { if (store.save) {
store.save(function (err, data) { return store.save(function (err, data) {
if (err) return next(err); if (err) {
return next(err);
}
if (typeof data == 'object' && data !== null) { if (typeof data == 'object' && data !== null) {
memo.push(data); memo.push(data);
} }
next(null, memo);
}); });
} else if (store.saveSync) { }
else if (store.saveSync) {
memo.push(store.saveSync()); memo.push(store.saveSync());
} }
next(null, memo); next(null, memo);
} }

View file

@ -14,7 +14,7 @@ var assert = require('assert'),
// //
require('./mocks/mock-store'); require('./mocks/mock-store');
vows.describe('nconf/provider').addBatch({ vows.describe('nconf/provider/save').addBatch({
"When using nconf": { "When using nconf": {
"an instance of 'nconf.Provider'": { "an instance of 'nconf.Provider'": {
"with a Mock store": { "with a Mock store": {