@venncity/nested-config
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [1.1.0](https://github.com/venn-city/npm-shelf/compare/@venncity/nested-config@1.0.2...@venncity/nested-config@1.1.0) (2019-05-02) | ||
### Bug Fixes | ||
* **config:** fixed linting ([313a04b](https://github.com/venn-city/npm-shelf/commit/313a04b)) | ||
* **config:** refactored config to recieve options object ([bab4876](https://github.com/venn-city/npm-shelf/commit/bab4876)) | ||
### Features | ||
* **config:** added ability to get props from parent config ([6c0ddfd](https://github.com/venn-city/npm-shelf/commit/6c0ddfd)) | ||
## [1.0.2](https://github.com/venn-city/npm-shelf/compare/@venncity/nested-config@1.0.1...@venncity/nested-config@1.0.2) (2019-05-01) | ||
@@ -8,0 +25,0 @@ |
{ | ||
"name": "@venncity/nested-config", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"author": "Venn Engineering", | ||
@@ -45,3 +45,3 @@ "main": "src/nestedConfig.js", | ||
}, | ||
"gitHead": "86172685d9c7b63ebe9dd9224d112b90703e3ad8" | ||
"gitHead": "81a8cf5ee830b7619d0edc129d1fd1173a406756" | ||
} |
@@ -57,4 +57,10 @@ /* eslint-disable no-underscore-dangle,global-require */ | ||
test('should throw an error when failed to create config key', () => { | ||
test('should load parent value when get called with parent flag true', async () => { | ||
await createFileAtPath('/inner/config/test.json', '{ "prop": "inner" }'); | ||
await createFileAtPath('/inner/package.json', '{ "prop": "123" }'); | ||
const innerModulePath = await createFileAtPath('/inner/src/module.js', '{ "prop": "123" }'); | ||
const nestedConfig = require('./nestedConfig')(innerModulePath); | ||
const testValue = nestedConfig.get('prop', { parentConf: true }); | ||
expect(testValue).toEqual('outer'); | ||
}); | ||
@@ -61,0 +67,0 @@ |
@@ -37,4 +37,9 @@ process.env.ALLOW_CONFIG_MUTATIONS = true; | ||
return { | ||
get: key => config.get(`${packagePathToConfigKeyPrefix.get(packagePath)}.${key}`) | ||
get: (key, options = { getConfigFromParent: false }) => { | ||
if (options.parentConf) { | ||
return config.get(key); | ||
} | ||
return config.get(`${packagePathToConfigKeyPrefix.get(packagePath)}.${key}`); | ||
} | ||
}; | ||
}; |
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
9827
9
151