0.2.0 • Published 4 years ago

deep-prune v0.2.0

Weekly downloads
13
License
MIT
Repository
-
Last release
4 years ago

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]