Comparing version 0.1.1 to 0.1.2
@@ -8,2 +8,7 @@ # Confort Changelog | ||
## [v0.1.2] - 2019-09-25 | ||
### Changed | ||
- layering to not merge objects unless they are direct instances of `Object` and `Array` (mostly created with literals) | ||
## [v0.1.1] - 2019-09-23 | ||
@@ -22,1 +27,2 @@ | ||
[v0.1.1]: https://gitlab.com/GCSBOSS/confort/-/tags/v0.1.1 | ||
[v0.1.2]: https://gitlab.com/GCSBOSS/confort/-/tags/v0.1.2 |
@@ -22,2 +22,5 @@ const fs = require('fs'); | ||
const isMergeableObject = val => | ||
typeof val === 'object' && ['Object', 'Array'].includes(val.constructor.name); | ||
module.exports = class Confort extends EventEmitter { | ||
@@ -49,3 +52,4 @@ | ||
this.object = deepmerge(this.object, pathOrObject, { | ||
arrayMerge: (a, b) => b | ||
arrayMerge: (a, b) => b, | ||
isMergeableObject | ||
}); | ||
@@ -52,0 +56,0 @@ |
{ | ||
"name": "confort", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A library for incrementally build config objects through layering config files in many formats.", | ||
@@ -36,4 +36,4 @@ "main": "lib/main.js", | ||
"toml": "^3.0.0", | ||
"yaml": "^1.6.0" | ||
"yaml": "^1.7.0" | ||
} | ||
} |
@@ -80,2 +80,10 @@ const fs = require('fs'); | ||
it('Should replace objects with a class other than Object', () => { | ||
class Foo{ constructor(){ this.a = 'foo'; } } | ||
let conf = new Confort({ key: { a: 'a', b: 'bar' } }); | ||
conf.addLayer({ key: new Foo() }); | ||
assert.strictEqual(conf.object.key.a, 'foo'); | ||
assert.strictEqual(typeof conf.object.key.b, 'undefined'); | ||
}); | ||
it('Should load conf file when path is specified', () => { | ||
@@ -82,0 +90,0 @@ let conf = new Confort('./test/res/conf.toml'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17498
242
Updatedyaml@^1.7.0