Skip to content

Commit

Permalink
Fixed cloned output.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexindigo committed Nov 28, 2018
1 parent b12b6ba commit 4e10630
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/configly.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var merge = require('deeply')
var clone = require('deeply')
, getCacheKey = require('./get_cache_key.js')
;

Expand All @@ -19,7 +19,7 @@ function configly(options)

// create new running context with custom options
// fallback to default directories
context = this.new(merge(options || {}));
context = this.new(clone(options || {}));

// prepare cache key
cacheKey = getCacheKey.call(context);
Expand All @@ -31,5 +31,8 @@ function configly(options)

// return immutable copy
// always return object here
return merge(this._cache[cacheKey] || {});
return clone.call({
useCustomTypeOf: clone.behaviors.useCustomTypeOf,
'typeof': context.mergeTypeOf
}, this._cache[cacheKey] || {});
}
2 changes: 1 addition & 1 deletion test/fixtures/expected/env_vars_modifiers_custom.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var moment = require('moment');

var datetime = moment.utc('2016-01-01T00:00:00');
var date = new Date('Fri Jan 01 2016 00:00:00 GMT-0800');
var date = new Date('Fri Jan 01 2016 00:00:00');
var combinedDate = new Date('Thu Dec 31 2015 16:00:00 GMT-0800');

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions test/test-env_vars_modifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ test('treated environment variables with modifiers', function(t)
delete process.env['WITHOUT_ENV'];

configObj = config({ directories: configDir });

t.deepEqual(configObj, expected, 'expects to get right config object');
});

0 comments on commit 4e10630

Please sign in to comment.