Wondering what’s next for npm?Check out our public roadmap! »

    asenv
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/asenv package

    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

    653

    Version

    3.0.2

    License

    MIT

    Unpacked Size

    28.5 kB

    Total Files

    45

    Last publish

    Collaborators

    • avatar