0.1.3 • Published 6 years ago

truthy-keys v0.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

truthy-keys

NPM version npm license Travis Build Status Dependency Status

npm

Creates an array of the own enumerable property names of an object for which the values are truthy.

Installation

$ npm install truthy-keys

Usage examples

truthyKeys({ foo: true, bar: false });
// ["foo"]

truthyKeys('foo');
// ["0", "1", "2"]

truthyKeys(/* any falsey value */);
// []

truthyKeys(42);
// []

See the tests.

Testing

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.

Watching

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.