Parse a set of environment variables as a JSON object
Install env-object-parser
by running:
npm install --save env-object-parser
Kind: Exported function
Summary: Parse an environment object
Returns: Object
- parsed object
Access: public
Param | Type | Description |
---|---|---|
environment | Object |
environment object |
options | Object |
options |
options.prefix | String |
environment prefix |
Example
const envObjectParser = require('env-object-parser')
process.env.FOO_BAR = 'baz'
const result = envObjectParser(process.env, {
prefix: 'FOO'
})
console.log(result.bar)
> 'baz'
Run the test
npm script:
npm test
- Issue Tracker: github.com/resin-io-modules/env-object-parser/issues
- Source Code: github.com/resin-io-modules/env-object-parser
Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:
npm run lint
If you're having any problem, please raise an issue on GitHub.
This project is free software, and may be redistributed under the terms specified in the license.