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

x/ayonli_jsext/object/index.ts>pick

A JavaScript extension package for building strong and modern applications.
Latest
function pick
import { pick } from "https://deno.land/x/ayonli_jsext@v0.9.72/object/index.ts";

Creates an object composed of the picked keys.

Examples

Example 1

import { pick } from "@ayonli/jsext/object";

const obj = { foo: "Hello", bar: "World" };

console.log(pick(obj, ["foo"])); // { foo: "Hello" }

Type Parameters

T extends object
U extends keyof T

Parameters

obj: T
keys: U[]

Returns

Pick<T, U>

Parameters

obj: T
keys: (string | symbol)[]

Returns

Partial<T>