Skip to content

assignSymbols

Functions

assignSymbols()

assignSymbols<T>(target, ...sources): T

分配符号属性到目标对象上

Type parameters

Parameter
T extends Object

Parameters

ParameterTypeDescription
targetT目标对象
...sourcesany[]一个或多个来源对象

Returns

T

Example

ts
const obj = {}

const obj1 = {}
obj1[Symbol('key1')] = 1

const obj2 = {}
obj2[Symbol('key2')] = 2

assignSymbols(obj, obj1, obj2)
// => { [Symbol('key1')]: 1, [Symbol('key2')]: 2 }