Package Exports
- parse-env-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-env-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
parse-env-string
Parse a string containing environment variables to a key/value object.
Installation
npm install parse-env-string --saveUsage
const parseEnvString = require('parse-env-string')
const env = parseEnvString('foo=hello bar= baz=", world"')
assert.deepStrictEqual(env, {
foo: 'hello',
bar: '',
baz: ', world'
})API
This modules exposes a single function:
parseEnvString([string])It takes a string and returns an object. If given null or undefined
an empty object is returned. If given anything else, a TypeError is
thrown.
An Error will also be thrown if the provided string doesn't contain
valid environment variables. E.g. if given the string 1a=b, an error
will be thrown because environment variables cannot have a digit as the
first character.