truthy-strings-keys
v0.4.3
Published
Resolves a simple string or a potentially deeply nested structure of primitive values into a simple string array.
Downloads
7
Maintainers
Readme
truthy-strings-keys
Resolves a simple string or a potentially deeply nested structure of primitive values into a simple string array.
Installation
$ npm install truthy-strings-keys
Usage
truthyStringsKeys( deepArray [, options] )
const deepArray = [
'foo', [
{
bar: true,
baz: null,
},
],
'foo',
'qux',
[
[
[
{
corge: undefined,
garpley: -1,
},
],
],
],
];
truthyStringsKeys(deepArray);
// ["foo", "bar", "foo", "qux", "garpley"]
truthyStringsKeys(deepArray, { unique: true });
// ["foo", "bar", "qux", "garpley"]
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.