Skip to content

Little util function for simpler extracting Boolean values from ENV variables in Node.js.

License

Notifications You must be signed in to change notification settings

grimen/node-env-flag

Repository files navigation

NODE-ENV-FLAG NPM version Build Status Coverage Status

Little util function for simpler extracting Boolean values from ENV variables in Node.js, i.e. true values (true, TRUE, 1) vs. false values (false, FALSE, 0).

Example

const DEFAULT_FOO = 1

const flag = require('node-env-flag')

const yep = flag(process.env.FOO, DEFAULT_FOO)

if (yep) {
    console.log("Foo!")
}

API

  • (value)

    flag(process.env.FOO);
  • (value, default)

    flag(process.env.FOO, 1);

Installation

$ npm install node-env-flag

Test

Local tests:

$ make test

License

Released under the MIT license.

Copyright (c) Jonas Grimfelt

About

Little util function for simpler extracting Boolean values from ENV variables in Node.js.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published