Creates an array of the own enumerable property names of an object for which the values are truthy.
$ npm install truthy-keys
truthyKeys({ foo: true, bar: false });
// ["foo"]
truthyKeys('foo');
// ["0", "1", "2"]
truthyKeys(/* any falsey value */);
// []
truthyKeys(42);
// []
See the tests.
Run the following command:
$ npm test
This will build scripts, run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.
For much faster development cycles, run the following commands in 2 separate processes:
$ npm run build:watch
Compiles TypeScript source into the ./dist
folder and watches for changes.
$ npm run watch
Runs the tests in the ./dist
folder and watches for changes.