@univerjs/core v0.4.2 • Docs
Function: mergeWith()
mergeWith(object, source, customizer)
function mergeWith<TObject, TSource>(
object,
source,
customizer): TObject & TSource
This method is like _.merge
except that it accepts customizer
which
is invoked to produce the merged values of the destination and source
properties. If customizer
returns undefined
merging is handled by the
method instead. The customizer
is invoked with seven arguments:
(objValue, srcValue, key, object, source, stack).
Type Parameters
Type Parameter |
---|
TObject |
TSource |
Parameters
Parameter | Type | Description |
---|---|---|
object | TObject | The destination object. |
source | TSource | - |
customizer | (value , srcValue , key , object , source ) => any | The function to customize assigned values. |
Returns
TObject
& TSource
Returns object
.
Example
function customizer(objValue, srcValue) {
if (_.isArray(objValue)) {
return objValue.concat(srcValue);
}
}
var object = {
'fruits': ['apple'],
'vegetables': ['beet']
};
var other = {
'fruits': ['banana'],
'vegetables': ['carrot']
};
_.mergeWith(object, other, customizer);
// => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
Defined in
submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1937
mergeWith(object, source1, source2, customizer)
function mergeWith<TObject, TSource1, TSource2>(
object,
source1,
source2,
customizer): TObject & TSource1 & TSource2
Type Parameters
Type Parameter |
---|
TObject |
TSource1 |
TSource2 |
Parameters
Parameter | Type |
---|---|
object | TObject |
source1 | TSource1 |
source2 | TSource2 |
customizer | (value , srcValue , key , object , source ) => any |
Returns
TObject
& TSource1
& TSource2
See
_.mergeWith
Defined in
submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1941
mergeWith(object, source1, source2, source3, customizer)
function mergeWith<TObject, TSource1, TSource2, TSource3>(
object,
source1,
source2,
source3,
customizer): TObject & TSource1 & TSource2 & TSource3
Type Parameters
Type Parameter |
---|
TObject |
TSource1 |
TSource2 |
TSource3 |
Parameters
Parameter | Type |
---|---|
object | TObject |
source1 | TSource1 |
source2 | TSource2 |
source3 | TSource3 |
customizer | (value , srcValue , key , object , source ) => any |
Returns
TObject
& TSource1
& TSource2
& TSource3
See
_.mergeWith
Defined in
submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1945
mergeWith(object, source1, source2, source3, source4, customizer)
function mergeWith<TObject, TSource1, TSource2, TSource3, TSource4>(
object,
source1,
source2,
source3,
source4,
customizer): TObject & TSource1 & TSource2 & TSource3 & TSource4
Type Parameters
Type Parameter |
---|
TObject |
TSource1 |
TSource2 |
TSource3 |
TSource4 |
Parameters
Parameter | Type |
---|---|
object | TObject |
source1 | TSource1 |
source2 | TSource2 |
source3 | TSource3 |
source4 | TSource4 |
customizer | (value , srcValue , key , object , source ) => any |
Returns
TObject
& TSource1
& TSource2
& TSource3
& TSource4
See
_.mergeWith
Defined in
submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1949
mergeWith(object, otherArgs)
function mergeWith(object, ...otherArgs): any
Parameters
Parameter | Type |
---|---|
object | any |
...otherArgs | any [] |
Returns
any
See
_.mergeWith
Defined in
submodules/univer/node_modules/.pnpm/@types+lodash@4.17.7/node_modules/@types/lodash/common/object.d.ts:1953