Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 673 Bytes

File metadata and controls

36 lines (25 loc) · 673 Bytes
category
Utilities

makeDestructurable

Make isomorphic destructurable for object and array at the same time. See this blog for more details.

Usage

TypeScript Example:

import { makeDestructurable } from '@vueuse/core'

const foo = { name: 'foo' }
const bar = 1024

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

Usage:

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