Dryrun
Checks if the DRY_RUN
environment variable is set to a truthy value. It considers any value truthy
other than: unset
, ""
, "0"
, "false"
and "no"
.
Usage
Simply install with npm or yarn:
npm install dryrunyarn add dryrun
To use it, import the isDryRun
or shouldPerform
functions:
const isDryRun shouldPerform = ;console; // true if DRY_RUN was setconsole; // opposite of isDryRun()
Testing
dryrun
comes with two handy functions for testing:
const resetDryRun setDryRun = ; ; // explicitly activate DRY_RUN...; // reset DRY_RUN to the environment value