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.
- Install with
npm i @tycrek/isprod
- Set your
NODE_ENV
toproduction
using your preferred method (it must be accessible fromprocess.env
). - Use it:
import isProd from '@tycrek/isprod'; console.log(isProd()); // or, to enable strict mode: console.log(isProd(true)); // output: true or false
Lazy | Strict |
---|---|
isProd() |
isProd(true) |
Matches "prod" or more | Matches only "production" |
Modify .env.test
to your liking and run npm run test
.
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!)