UNPKG

clean-object-keys

Version:

A tiny JavaScript utility to remove null, undefined, and empty string values from objects. Lightweight and supports nested objects.

10 lines (9 loc) 288 B
// Removes null, undefined, and empty string keys function cleanObject(obj) { return Object.fromEntries( Object.entries(obj).filter( ([, value]) => value !== null && value !== undefined && value !== "" ) ); } module.exports = { cleanObject };