Alchemy Logo

pick

function 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.

import { pick } from "@aa-sdk/core";
 
const picked = pick(
  {
    foo: "foo",
    bar: "bar",
  },
  ["foo"],
); // { foo: "foo" }

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

object

A new object containing only the picked key-value pairs

Was this page helpful?