Get all flags present on argv and his value easily Check if argv has a specific flag
$ npm install --save flagr
$ node foo.js --prod --watch --env="production"
// foo.js
const { exist } = require('flagr');
exist('--prod');
//=> true
exist('prod');
//=> true
exist('--watch');
//=> true
exist('--env');
//=> true
exist('--test');
//=> false
$ node foo.js --prod --watch="true" --env="production"
// foo.js
const { get } = require('flagr');
get('--prod');
//=> ''
get('--watch');
//=> true
get('--env');
//=> production
get('env');
//=> production
Returns a boolean whether the flag exists.
Type: string
CLI flag to look for. The --
prefix is optional.
Type: array
Default: process.argv
Returns the value from flag.
Type: string
CLI flag to look for. The --
prefix is optional.
Type: array
Default: process.argv