3.0.2 • Published 5 years ago

asenv v3.0.2

Weekly downloads
533
License
MIT
Repository
github
Last release
5 years ago

asenv

Build Status Code Climate Code Coverage npm Version JS Standard

NODE_ENV accessor

Installation

$ npm install asenv --save

Usage

'use strict'

const { getEnv, setEnv, isProduction } = require('asenv')

{
  let env = getEnv()
  console.log('env=', env)

  /* ... */

  setEnv('production')

  /* ... */

  if (isProduction()) {
    /* ... */
  }
}

Functions

Available functions

SignatureDescription
.getEnv()() -> ?stringGet NODE_ENV value
.isDevelopment() -> booleanCheck if the env it development
.isProduction() -> booleanCheck if the env is production
.isTest() -> booleanCheck if the env is test
.setEnv()(env)Set NODE_ENV value
.unlessProduction(handler)Do unless production

License

This software is released under the MIT License.

Links