Skip to content

Commit

Permalink
[dist] Semantic cleanup from sloppy coding in #76.
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Nov 26, 2014
1 parent ffce2cb commit f771500
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/nconf/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
});

Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit f771500

Please sign in to comment.