The _.extend()
function from lodash is used to copy all properties of a source object to a destination object. It can take multiple source objects as arguments and returns the destination object after all properties are copied.
Here's an example usage:
index.tsx280 chars10 lines
In the example above, source1
and source2
are two objects whose properties we want to copy to the dest
object. The _.extend()
function is called with dest
followed by source1
and source2
as arguments. The dest
object is updated with properties from all source objects, and the updated object is returned.
Note that if multiple source objects have properties with the same name, the value of the last source object takes precedence.
gistlibby LogSnag