pick

1function pick(obj, keys): object;

Defined in: aa-sdk/core/src/utils/index.ts:125

Picks the specified keys from an object and returns a new object containing only those key-value pairs.

Example

1import { pick } from "@aa-sdk/core";
2
3const picked = pick(
4 {
5 foo: "foo",
6 bar: "bar",
7 },
8 ["foo"],
9); // { foo: "foo" }

Parameters

ParameterTypeDescription

obj

Record<string, unknown>

The object from which to pick keys

keys

string | string[]

A single key or an array of keys to pick from the object

Returns

object

A new object containing only the picked key-value pairs