Skip to content

makeDestructurable

Category
Processing
Environment
Node & Browser
Last updated
2024/04/22 08:13:11

Same as VueUse's makeDestructurable. See antfu's posts for more detail.

Usage

ts
import { makeDestructurable } from "@bernankez/utils";

const foo = { name: "foo" };
const bar = 1024;

const obj = makeDestructurable(
  { foo, bar } as const,
  [foo, bar] as const
);

Use

ts
let { foo, bar } = obj;
let [foo, bar] = obj;

Source

SourceDocs