Skip to content

balena-io-modules/env-object-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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'

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.

About

Parse a set of environment variables as a JSON object

Resources

License

Stars

Watchers

Forks

Packages

No packages published