UNPKG

just-flush

Version:

returns a copy of an array or object with null/undefined members removed

29 lines (21 loc) 838 B
<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE --> <!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template --> ## just-flush Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion. [`🍦 Try it`](https://anguscroll.com/just/just-flush) ```shell npm install just-flush ``` ```shell yarn add just-flush ``` Returns a copy of an array or object with null/undefined members removed ```js 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 ```