API Reference
@univerjs
@univerjs/core
functions
Merge

@univerjs/core v0.4.2Docs


Function: merge()

merge(object, source)

function merge<TObject, TSource>(object, source): TObject & TSource

Recursively merges own and inherited enumerable properties of source objects into the destination object, skipping source properties that resolve to undefined. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

Note: This method mutates object.

Type Parameters

Type Parameter
TObject
TSource

Parameters

ParameterTypeDescription
objectTObjectThe destination object.
sourceTSource-

Returns

TObject & TSource

Returns object.

Example

var users = {
  'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
};
 
var ages = {
  'data': [{ 'age': 36 }, { 'age': 40 }]
};
 
_.merge(users, ages);
// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1838

merge(object, source1, source2)

function merge<TObject, TSource1, TSource2>(
   object, 
   source1, 
   source2): TObject & TSource1 & TSource2

Type Parameters

Type Parameter
TObject
TSource1
TSource2

Parameters

ParameterType
objectTObject
source1TSource1
source2TSource2

Returns

TObject & TSource1 & TSource2

See

_.merge

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1842

merge(object, source1, source2, source3)

function merge<TObject, TSource1, TSource2, TSource3>(
   object, 
   source1, 
   source2, 
   source3): TObject & TSource1 & TSource2 & TSource3

Type Parameters

Type Parameter
TObject
TSource1
TSource2
TSource3

Parameters

ParameterType
objectTObject
source1TSource1
source2TSource2
source3TSource3

Returns

TObject & TSource1 & TSource2 & TSource3

See

_.merge

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1846

merge(object, source1, source2, source3, source4)

function merge<TObject, TSource1, TSource2, TSource3, TSource4>(
   object, 
   source1, 
   source2, 
   source3, 
   source4): TObject & TSource1 & TSource2 & TSource3 & TSource4

Type Parameters

Type Parameter
TObject
TSource1
TSource2
TSource3
TSource4

Parameters

ParameterType
objectTObject
source1TSource1
source2TSource2
source3TSource3
source4TSource4

Returns

TObject & TSource1 & TSource2 & TSource3 & TSource4

See

_.merge

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1850

merge(object, otherArgs)

function merge(object, ...otherArgs): any

Parameters

ParameterType
objectany
...otherArgsany[]

Returns

any

See

_.merge

Defined in

submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1854


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.