asenv
NODE_ENV accessor
Last updated 4 months ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ 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

Current Tags

  • 3.0.1                                ...           latest (4 months ago)

12 Versions

  • 3.0.1                                ...           4 months ago
  • 3.0.0                                ...           4 months ago
  • 2.0.2                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |