pruneValueWhen
Remove property from an object when predicate is true
Import
import { pruneValueWhen } from '@fullstacksjs/toolbox';
Signature
function pruneValueWhen(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number {}
Examples
pruneValueWhen({ a: { b: null } }, v => !v) // { a: { b: null } }
pruneValueWhen({ a: null, b: '', c: undefined }, v => !v) // {}
pruneValueWhen({ a: 'John', b: null, c: '', d: undefined }, v => !v) // { a: 'John' }