2.0.1 • Published 3 years ago

isprod2 v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

isprod2

npm image

I wanted what linkeo/isprod had made but didn't like the very outdated codebase that used some old concepts. So I rewrote it into what is essentially a glorified Regular Expression.

Usage

  1. Install with npm i isprod2
  2. Set your NODE_ENV to production using your preferred method.
  3. Use it:

    // isProd is a boolean
    const isProd = require('isprod2')();
    
    // enable strict mode
    const isProd = require('isprod2')(true);
    
    console.log(isProd); // true (or false)
    
    // can also be used inline
    if (require('isprod2')()) {
        // do something
    }

Modes

LazyStrict
isProd()isProd(true)
Matches "prod" or moreMatches only "production"

Testing

Modify .env.test to your liking and run npm test.

Contributing

You do realize this entire project can be replaced with less than a line of code right? (But by all means any contributions are welcome!)

2.0.1

3 years ago

2.0.0

3 years ago