node-env-match

1.0.0 • Public • Published

node-env-match

NPM Version Travis Build

Utility to test the value of the NODE_ENV system variable.

Usage

Add node-env-match as a project dependency

$ npm install node-env-match --save

Require and use it is really simple

// Suppose you run your app with
// NODE_ENV=simple-test
 
var nodeEnvMatch = require('node-env-match');
 
// you can use a string argument
nodeEnvMatch("simple-test") // => true
nodeEnvMatch("test") // => false
 
// or a regular expression
nodeEnvMatch(/simple-test/) // => true
nodeEnvMatch(/test/) // => true
 
// or array of strings/reg-exp
// it returns true if at least one matches
nodeEnvMatch(['test',/test/]) // => true
nodeEnvMatch(['test',/tost/]) // => false
 

You can see more examples in test/node-env-match file.

Test

$ npm test

License

MIT © Andrea Tarquini

Package Sidebar

Install

npm i node-env-match

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • h4t0n