Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/itertools/custom.ts>compactObject

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Go to Latest
function compactObject
import { compactObject } from "https://deno.land/x/itertools@v1.1.1/custom.ts";

Removes all undefined values from the given object. Returns a new object.

>>> compactObject({ a: 1, b: undefined, c: 0 })
{ a: 1, c: 0 }

Type Parameters

O extends Record<string, unknown>