Hey community! ๐ If you're building or maintaining JavaScript apps and want clean, efficient, and valid payloads, check out clean-object-keys โ a tiny utility to remove null, undefined, and empty strings ("") from your objects.
๐ What It Does
It cleans up your objects by removing noise before you send them to APIs, save configs, or process data.
const { cleanObject } = require("clean-object-keys");
const messy = {
name: "Alex",
email: "",
phone: undefined,
age: null,
};
const clean = cleanObject(messy);
// Output: { name: "Alex" }
๐ก Why Devs Love It
โ
Clean request payloads
โ
Sanitize form inputs
โ
Works with nested objects
โ
No dependencies
โ
Super lightweight
๐ฆ Install & Use
npm install clean-object-keys
๐ NPM Package: https://www.npmjs.com/package/clean-object-keys
Then import and go!
const { cleanObject } = require("clean-object-keys");
๐ค Contribute or Star
Created by Manu Kumar Pal, this package is open-source and ready for your PRs, ideas, or stars โญ.
Top comments (0)