just-flush
v2.3.0
Published
returns a copy of an array or object with null/undefined members removed
Downloads
44,927
Maintainers
Readme
just-flush
Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
npm install just-flush
yarn add just-flush
Returns a copy of an array or object with null/undefined members removed
import flush from 'just-flush';
flush([1, undefined, 2, null, 3, NaN, 0]); // [1, 2, 3, NaN, 0]
flush([true, null, false, true, [null], undefined]); // [true, false, true, [null]]
flush({a: 2, b: null, c: 4, d: undefined}); // {a: 2, c: 4}
flush('something'); // undefined
flush(); // undefined