3.0.0 • Published 5 years ago

sprawl v3.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

sprawl

About

sprawl sets and/or gets environment variables.

Documentation

Installation

Use sprawl as you would any CommonJS Node module.

Example
const sprawl = require('sprawl');

or via destructuring

const { current, isProduction, seize } = require('sprawl');

Properties


.current

Returns the current environment (via process.env.NODE_ENV)

Example
sprawl.current // => 'test'

.environments

Returns an array of valid environments

Current valid environments
  • development
  • test
  • staging
  • production
Example
sprawl.environments // => [ 'development', 'production', 'staging', 'test' ]

.isProduction

Returns a boolean if the current environment is production

Example
sprawl.isProduction // => true

Methods


#seize(name, value)

Sets an environment variable.

Arguments
  • name <String>
  • value <Number>, <Object>, <String>
Examples
sprawl.seize('JENNYS_PHONENUM', 8675309) // => '8675309'
sprawl.seize('JENNYS_RELEASE_DATE', { development: '1981' }) // => '1981'
sprawl.seize('JENNYS_RECORD_LABEL', 'Columbia Records') // => 'Columbia Records'
Notes
  • All values are converted to <String>
  • If using an <Object> as the value, only valid environments are allowed as keys.

#seize(name)

Returns an environment variable.

Arguments
  • name <String>
Example
sprawl.seize('JENNYS_PHONENUM') // => '8675309'
3.0.0

5 years ago

2.0.0

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago