3.0.2 • Published 2 years ago
@tycrek/isprod v3.0.2
isprod
A glorified regular expression.
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 @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
Modes
Lazy | Strict |
---|---|
isProd() | isProd(true) |
Matches "prod" or more | Matches only "production" |
Testing
Modify .env.test
to your liking and run npm run 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!)