Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

asenv

3.0.2 • Public • Published

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

Keywords

Install

npm i asenv

DownloadsWeekly Downloads

652

Version

3.0.2

License

MIT

Unpacked Size

28.5 kB

Total Files

45

Last publish

Collaborators

  • avatar