Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

compact-array

miguelmota3MIT0.0.1

Returns an array with "non-empty" values only.

compact, array

readme

compact-array

Returns an array with non-empty values only.

Install

npm install compact-array
bower install compact-array

Usage

var compact = require('compact-array');

var array = [
  'b',
  null,
  false,
  1,
  0,
  '',
  ['lolz', null, ['a',4,null], undefined]
];

console.log(compact(array));
// [
    'b',
    false,
    1,
    0,
    ['lolz',['a',4]
  ]

console.log(compact('non array')); // []

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file.