deep-prune
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

deep-prune

Build Version Size License

Deeply prunes null or undefined values from an array or object.

You can also customize the values that get pruned.

Usage

import { deepPrune } from "deep-prune";
 
deepPrune({ foo: null, bar: 100 });
// { bar: 100 }
 
deepPrune([1, null, undefined, ""]);
// [1, ""]
 
deepPrune([{ foo: { bar: null, buzz: 2 } }]);
// [{ foo: { buzz: 2 } }]
 
deepPrune([1, 2, 3], value => value === 1);
// [2, 3]

Readme

Keywords

none

Package Sidebar

Install

npm i deep-prune

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

29.3 kB

Total Files

9

Last publish

Collaborators

  • rzane