@jswork/next-compact

1.1.0 • Public • Published

next-compact

Returns a copy of the array/object with all falsy values removed.

version license size download

installation

npm install -S @jswork/next-compact

usage

import '@jswork/next-compact';

const arr1 = [0, 1, false, 2, '', 3];
const arr2 = [0, 1, false, 2, '', 3, [], [], 'a'];

const result1 = nx.compact(arr);
const result2 = nx.compact(obj);

// [1, 2, 3]
// [1, 2, 3, 'a']

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/next-compact

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

5.27 kB

Total Files

5

Last publish

Collaborators

  • afeiship