@thinice/pick-defined
v0.1.4
Published
Drops keys with undefined values from an object
Readme
@thinice/pick-defined
Drops keys with undefined values from an object.
Installation
npm install @thinice/pick-definedUsage
import { pickDefined } from "@thinice/pick-defined";
pickDefined({ a: 1, b: undefined, c: 3 }); // { a: 1, c: 3 }
pickDefined({ a: 1, b: null, c: 0 }); // { a: 1, b: null, c: 0 } (null kept)Use omitNullish if you also want to remove null values.
Source
https://github.com/thinicejs/utils/tree/main/packages/pick-defined
