Skip to content

makeDestructurable

Category
Export Size
364 B
Last Changed
last year

使对象和数组具有等价的解构性能。详见这篇博文获取更多详情。

用法

TypeScript 示例:

ts
import { makeDestructurable } from '@vueuse/core'

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

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

用法:

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

类型声明

typescript
export declare function makeDestructurable<
  T extends Record<string, unknown>,
  const A extends readonly any[],
>(obj: T, arr: A): T & A

Source

SourceDocs

贡献者

Anthony Fu
丶远方
enpitsulin

变更日志

v10.10.0 on 5/27/2024
4ea13 - feat: support parameters without as const (#3971)

Released under the MIT License.

Save 37% on one year of learning Vue, Includes the Vue.js Master Class.
Get Offer