npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

arrayify-compact

0.2.0

@jonschlinkert

npmHomeRepoSnykSocket
Downloads:100181
$ npm install arrayify-compact
DailyWeeklyMonthlyYearly

arrayify-compact NPM version

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

  • github/jonschlinkert
  • twitter/jonschlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on July 06, 2014.