You can use the defaultsDeep
function from lodash library in typescript as follows:
index.ts33 chars2 lines
defaultsDeep
function from the lodash library as follows:index.ts39 chars2 lines
defaultsDeep
function to merge default values into an object as follows:index.ts186 chars7 lines
In the above code, we have merged the source
object into the object
object using the defaultsDeep
function.
Note: The defaultsDeep
function recursively merges objects to create a new object, so it does not modify any of the objects passed to it.
gistlibby LogSnag