1.1.0 • Published 6 years ago

env-object-parser v1.1.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 years ago

env-object-parser

npm npm license npm downloads travis

Parse a set of environment variables as a JSON object

Installation

Install env-object-parser by running:

npm install --save env-object-parser

Documentation

module.exports(environment, options) ⇒ Object

Kind: Exported function
Summary: Parse an environment object
Returns: Object - parsed object
Access: public

ParamTypeDescription
environmentObjectenvironment object
optionsObjectoptions
options.prefixStringenvironment 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'

Tests

Run the test npm script:

npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:

npm run lint

Support

If you're having any problem, please raise an issue on GitHub.

License

This project is free software, and may be redistributed under the terms specified in the license.