which-node-env
v1.3.0
Published
Tells you which NODE_ENV you're in.
Downloads
7
Readme
Which Node Env?
An easy way to get some booleans like isDev
, isTest
, isStage
or isProd
.
Synopsis
// simple.js
const nodeEnv = require('which-node-env')
console.log(nodeEnv)
If you run the above program as follows, you get:
$ NODE_ENV=dev node simple.js
{
nodeEnv: 'dev',
isDev: true,
isTest: false,
isStage: false,
isProd: false,
isUnknown: false
}
You might only be interested in some of these vars:
const { isDev, isTest, isProd } = require('which-node-env')
if (isDev) {
console.log("Dev")
}
if (isTest) {
console.log("Test")
}
if (isProd) {
console.log("Prod")
}
That's all folks!
About
$ npx chilts
╒════════════════════════════════════════════════════╕
│ │
│ Andrew Chilton (Personal) │
│ ------------------------- │
│ │
│ Email : [email protected] │
│ Web : https://chilts.org │
│ Twitter : https://twitter.com/andychilton │
│ GitHub : https://github.com/chilts │
│ │
│ Apps Attic Ltd (My Company) │
│ --------------------------- │
│ │
│ Email : [email protected] │
│ Web : https://appsattic.com │
│ Twitter : https://twitter.com/AppsAttic │
│ GitHub : https://github.com/appsattic │
│ │
│ Node.js / npm │
│ ------------- │
│ │
│ Profile : https://www.npmjs.com/~chilts │
│ Card : $ npx chilts │
│ │
╘════════════════════════════════════════════════════╛
(Ends)