2.0.1 • Published 3 years ago
isprod2 v2.0.1
isprod2
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
- Install with
npm i isprod2
- Set your
NODE_ENV
toproduction
using your preferred method. 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
Lazy | Strict |
---|---|
isProd() | isProd(true) |
Matches "prod" or more | Matches 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!)