asenv
NODE_ENV accessor
Last updated 10 days ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install asenv 
SYNC missed versions from official npm registry.

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

Signature Description
.getEnv()() -> ?string Get NODE_ENV value
.isDevelopment() -> boolean Check if the env it development
.isProduction() -> boolean Check if the env is production
.isTest() -> boolean Check 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


Copyright 2014 - 2016 © taobao.org |