[dist] Semantic cleanup from sloppy coding in #76.

This commit is contained in:
indexzero 2014-11-26 01:02:59 -05:00
parent ffce2cbec1
commit f771500266

View file

@ -29,13 +29,11 @@ var Provider = exports.Provider = function (options) {
// Define wrapper functions for using basic stores // Define wrapper functions for using basic stores
// in this instance // in this instance
// //
Provider.prototype['argv'] = function(options, usage) {
return this.add('argv', options, usage);
};
['env'].forEach(function (type) { ['add', 'env'].forEach(function (type) {
Provider.prototype[type] = function (options) { Provider.prototype[type] = function () {
return this.add(type, options); 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 } ? { file: options }
: options; : options;
} }
options.type = 'file'; options.type = 'file';
return this.add(key, options); return this.add(key, options);
}; };
// //
// Define wrapper functions for using // Define wrapper functions for using
// overrides and defaults // overrides and defaults
// //
['defaults', 'overrides'].forEach(function (type) { ['defaults', 'overrides'].forEach(function (type) {
@ -422,7 +420,7 @@ Provider.prototype.load = function (callback) {
// //
// ### function save (callback) // ### function save (callback)
// #### @callback {function} **optional** Continuation to respond to when // #### @callback {function} **optional** Continuation to respond to when
// complete. // complete.
// Instructs each provider to save. If a callback is provided, we will attempt // Instructs each provider to save. If a callback is provided, we will attempt
// asynchronous saves on the providers, falling back to synchronous saves if // asynchronous saves on the providers, falling back to synchronous saves if
@ -468,18 +466,18 @@ Provider.prototype.save = function (value, callback) {
if (err) { if (err) {
return next(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); 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);
} }