Skip to content

Commit

Permalink
[fix] Do not change lexigraphic ordering of keys in this.stores.
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero authored and Matt Hamann committed Aug 16, 2017
1 parent 4d9364d commit bb07f1d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/nconf/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ Provider.prototype.use = function (name, options) {
var store = this.stores[name],
update = store && !sameOptions(store);

if (!store) {
this.add(name, options);
} else if (store && update) {
if (!store || update) {
if (update) {
this.remove(name);
}

this.add(name, options);
}

Expand Down Expand Up @@ -146,7 +148,7 @@ Provider.prototype.add = function (name, options, usage) {
// this was used in the call to `.add()`.
//
Provider.prototype.remove = function (name) {
delete this.stores[name];
this.stores[name] = null;
return this;
};

Expand Down

0 comments on commit bb07f1d

Please sign in to comment.