cosmiconfig
Advanced tools
Comparing version 5.0.7 to 5.1.0
# Changelog | ||
## 5.1.0 | ||
- Added: `packageProp` values can include periods to describe paths to nested objects within `package.json`. | ||
## 5.0.7 | ||
@@ -4,0 +8,0 @@ |
@@ -5,2 +5,3 @@ // | ||
const path = require('path'); | ||
const get = require('lodash.get'); | ||
const loaders = require('./loaders'); | ||
@@ -177,3 +178,3 @@ const readFile = require('./readFile'); | ||
const parsedContent = loaders.loadJson(filepath, content); | ||
const packagePropValue = parsedContent[this.config.packageProp]; | ||
const packagePropValue = get(parsedContent, this.config.packageProp); | ||
return packagePropValue || null; | ||
@@ -180,0 +181,0 @@ } |
{ | ||
"name": "cosmiconfig", | ||
"version": "5.0.7", | ||
"version": "5.1.0", | ||
"description": "Find and load configuration from a package.json property, rc file, or CommonJS module", | ||
@@ -89,2 +89,3 @@ "main": "dist/index.js", | ||
"js-yaml": "^3.9.0", | ||
"lodash.get": "^4.4.2", | ||
"parse-json": "^4.0.0" | ||
@@ -91,0 +92,0 @@ }, |
@@ -216,2 +216,6 @@ # cosmiconfig | ||
Type: `Object`. | ||
Possible options are documented below. | ||
### searchPlaces | ||
@@ -410,2 +414,12 @@ | ||
Use periods to describe a path to nested properties. For example, the value `'configs.myPackage'` will get you the `"myPackage"` value in a `package.json` like this: | ||
```json | ||
{ | ||
"configs": { | ||
"myPackage": {..} | ||
} | ||
} | ||
``` | ||
### stopDir | ||
@@ -412,0 +426,0 @@ |
41541
429
513
5
+ Addedlodash.get@^4.4.2
+ Addedlodash.get@4.4.2(transitive)