♻️ Get, set, or delete nested properties of process.env using a dot path
Coded with ❤️ by Simone Primarosa.
any
Gets the values of environment variables at the path specified.
**Kind**: global function
**Returns**: any - The values of environment variables associated with the path specified.
**Access**: public
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| path | string | | Dot separated path. |
| [defaultValue] | any | | Default value to return if there is not any environment variable that matches the path provided. |
| [opts] | Object | | Additional options. |
| [opts.parse] | boolean | false | If true the value retrieved is converted to the proper type. |
| [opts.caseSensitive] | boolean | false | If true no case conversion will be performed from the dot path provided to the env key search. Eg: 'tesT.kEy' will look for tesT_kEy environment variable instead of TEST_KEY. |
## set(path, value, [opts])
Sets an env key at the path specified. If nested keys are present they will
be deleted.
**Kind**: global function
**Access**: public
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| path | string | | Dot separated path. |
| value | string | | Value to set. |
| [opts] | object | | Additional options. |
| [opts.stringify] | boolean | false | If true the value provided is converted to string. |
| [opts.caseSensitive] | boolean | false | If true no case conversion is performed from the dot path provided to the env key search. Eg: 'tesT.kEy' will look for tesT_kEy environment variable instead of TEST_KEY. |
## del(path, [opts])
Deletes an env key at the path specified.
If nested keys are present they will be deleted too.
**Kind**: global function
**Access**: public
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| path | string | | A dot separated path. |
| [opts] | object | | Additional options. |
| [opts.caseSensitive] | boolean | false | If true no case conversion is performed from the dot path provided to the env key search. Eg: 'tesT.kEy' will look for tesT_kEy environment variable instead of TEST_KEY. |
## has(path, [opts]) ⇒ boolean
Returns whether an env key exists at the path specified.
**Kind**: global function
**Returns**: boolean - true if exists at least one environment variables with that
path prefix.
**Access**: public
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| path | string | | Dot separated path. |
| [opts] | object | | Additional options. |
| [opts.caseSensitive] | boolean | false | If true no case conversion is performed from the dot path provided to the env key search. Eg: 'tesT.kEy' will look for tesT_kEy environment variable instead of TEST_KEY. |
## Authors
- **Simone Primarosa** - *Github* ([@simonepri][github:simonepri]) • *Twitter* ([@simoneprimarosa][twitter:simoneprimarosa])
See also the list of [contributors][contributors] who participated in this project.
## License
This project is licensed under the MIT License - see the [license][license] file for details.
[start]: https://github.com/simonepri/env-dot-prop#start-of-content
[new issue]: https://github.com/simonepri/env-dot-prop/issues/new
[contributors]: https://github.com/simonepri/env-dot-prop/contributors
[license]: https://github.com/simonepri/env-dot-prop/tree/master/license
[github:simonepri]: https://github.com/simonepri
[twitter:simoneprimarosa]: http://twitter.com/intent/user?screen_name=simoneprimarosa
[12factors]: https://12factor.net/config
[12factorsguide]: https://github.com/simonepri/env-dot-prop/wiki/Create-a-12-factor-compliant-configuration-system