Skip to content

doniyor2109/env-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env-tool

Helps working with environments easily

Build Status

Installation

npm install env-tool

or

yarn add env-tool

Usages

  • Run function in dev mode

    const env = require("env-tool");
    
    env.dev(function () {
      // runs in develpment
    });
  • Checks weather environment is production

    const env = require("env-tool");
    
    if (env.is.prod) {
      // true for production
    }
  • Log in development

    const env = require("env-tool");
    
    env.dev.warn("WARNING for development");
  • Run in not production

    env.not.prod(function () {
      // run on environment that is not production
    });

Configure

By default env-tool checks environment for node using process.env.NODE_ENV. However you can customize it yourself.

const env = require("env-tool");

env.setChecker(function (env) {
  return process.env.ENV === env;
});

License

MIT

Releases

No releases published

Packages

No packages published