## What is this? This is intended to be a fun way of accepting alternatives to `false` or "no" in CLI prompts, web forms, etc. For example, you might want to allow users to define `nil` or `nope` to disable something. ## Usage ```js const falsey = require('{%= name %}'); console.log(falsey()); //=> true console.log(falsey(false)); //=> true console.log(falsey('nil')); //=> true console.log(falsey('nope')); //=> true console.log(falsey('yes')); //=> false ``` ## Examples Any value that is not falsey (according to JavaScript) _and is not in the list_ of [falsey keywords](#falsey-keywords) will return `false`: ```js falsey('abc'); falsey(true); falsey(1); falsey('1'); falsey({}); falsey([]); ``` Any value that is falsey (according to JavaScript) _or is in the list_ of [falsey keywords](#falsey-keywords) will return `true`: ```js falsey(); //=> true falsey(''); //=> true falsey(0); //=> true falsey(false); //=> true falsey(NaN); //=> true falsey(null); //=> true falsey(undefined); //=> true falsey(void 0); //=> true ``` ### Falsey keywords If a value matches one of the built-in "falsey" keywords (all strings) it will return `true`: - `0` - `false` - `nada` - `nil` - `nay` - `nah` - `negative` - `no` - `none` - `nope` - `nul` - `null` - `nix` - `nyet` - `uh-uh` - `veto` - `zero` **Customize falsey keywords** Pass an array of custom keywords that should return `true` when evaluated as _falsey_: ```js falsey('zilch', ['no', 'nope', 'nada', 'zilch']); //=> true ``` Disable built-in keywords by passing an empty array: ```js falsey('nil', []); //=> false ``` **Extend built-in keywords** Built-in keywords are exposed on the `.keywords` property so that you may extend them with your own keywords: ```js falsey('zilch', falsey.keywords.concat(['zilch'])); //=> true ``` ## Release history ### v1.0 **Breaking changes** - objects will now always returns `false` - more words were added to the built-in list of [falsey keywords](#falsey-keywords)