h4t0n / node-env-match

A module to test if NODE_ENV match a string/RegExp or one in array of string/RegExp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A module to test if NODE_ENV match a string/RegExp or one in array of string/RegExp


Languages

Language:JavaScript 100.0%