Skip to content

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

License

Notifications You must be signed in to change notification settings

jednano/truthy-keys

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published