Recursively merges the values of target into source and returns the merged result.
Note the direction: source is the accumulator that is mutated and returned, while the
values of target take precedence for conflicting primitive values. Nested objects are
merged recursively and arrays are concatenated (source entries first, then target).
If source is not a JSON object, a deep copy of target is returned instead.
Only own properties are considered and reserved keys are ignored, so merged results are
always plain data objects.
Parameters
source: undefined|JSONValue
the accumulator to merge into; mutated and returned unless it is not an object
target: JSONValue
the values that are merged into source and take precedence on conflicts
Returns JSONValue
the merged result (the mutated source, or a deep copy of target)
Recursively merges the values of
targetintosourceand returns the merged result.Note the direction:
sourceis the accumulator that is mutated and returned, while the values oftargettake precedence for conflicting primitive values. Nested objects are merged recursively and arrays are concatenated (sourceentries first, thentarget). Ifsourceis not a JSON object, a deep copy oftargetis returned instead.Only own properties are considered and reserved keys are ignored, so merged results are always plain data objects.