0.2.0 • Published 5 years ago
arrayify-compact v0.2.0
arrayify-compact
Similar to Lo-Dash's compact method, but coerces values to arrays first, then returns a flattened array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are all falsey.
Install
Install with npm:
npm i arrayify-compact --save-dev
Usage
var arrayify = require('arrayify-compact');
console.log(arrayify('a'));
//=> ['a']
console.log(arrayify(['a', 'b', ['c', ['d']]]));
//=> ['a', 'b', 'c', 'd']
console.log(arrayify(['a', 'b', ['c', ['d'], null, false, 0, NaN, '', [], undefined]]));
//=> ['a', 'b', 'c', 'd']
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on July 06, 2014.