diff --git a/lib/nconf/provider.js b/lib/nconf/provider.js index 797fff5..c331c73 100644 --- a/lib/nconf/provider.js +++ b/lib/nconf/provider.js @@ -29,13 +29,11 @@ var Provider = exports.Provider = function (options) { // Define wrapper functions for using basic stores // in this instance // -Provider.prototype['argv'] = function(options, usage) { - return this.add('argv', options, usage); -}; -['env'].forEach(function (type) { - Provider.prototype[type] = function (options) { - return this.add(type, options); +['add', 'env'].forEach(function (type) { + Provider.prototype[type] = function () { + var args = [type].concat(Array.prototype.slice.call(arguments)); + return this.add.apply(this, args); }; }); @@ -60,13 +58,13 @@ Provider.prototype.file = function (key, options) { ? { file: options } : options; } - + options.type = 'file'; return this.add(key, options); }; // -// Define wrapper functions for using +// Define wrapper functions for using // overrides and defaults // ['defaults', 'overrides'].forEach(function (type) { @@ -422,7 +420,7 @@ Provider.prototype.load = function (callback) { // // ### function save (callback) -// #### @callback {function} **optional** Continuation to respond to when +// #### @callback {function} **optional** Continuation to respond to when // complete. // Instructs each provider to save. If a callback is provided, we will attempt // asynchronous saves on the providers, falling back to synchronous saves if @@ -468,18 +466,18 @@ Provider.prototype.save = function (value, callback) { if (err) { return next(err); } - + if (typeof data == 'object' && data !== null) { memo.push(data); } - + next(null, memo); }); - } + } else if (store.saveSync) { memo.push(store.saveSync()); } - + next(null, memo); }