npm.io
0.1.3 • Published 8 years ago

truthy-keys

Licence
MIT
Version
0.1.3
Deps
0
Vulns
0
Weekly
0

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.

Keywords