Skip to content

This is an alternative to the lodash's merge function, but it does overwrite values with undefined

License

Notifications You must be signed in to change notification settings

Istador/lodash-es-merge-undefined

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lodash-es-merge-undefined npm test

This is an alternative to the lodash's merge function, but it does overwrite values with undefined.

Example

import { merge as classic } from 'lodash-es'
import { merge as project } from 'lodash-es-merge-undefined'

const plain1 = { a: 1, b: 1 }
const plain2 = { a: 2, b: undefined }
console.log(classic(plain1, plain2))  //> { a: 2, b: 1 }
console.log(project(plain1, plain2))  //> { a: 2, b: undefined }

const deep1  = { sub: { a: 1, b: 1 } }
const deep2  = { sub: { a: 2, b: undefined } }
console.log(classic(deep1,  deep2 ))  //> { sub: { a: 2, b: 1 } }
console.log(project(deep1,  deep2 ))  //> { sub: { a: 2, b: undefined } }

About

This is an alternative to the lodash's merge function, but it does overwrite values with undefined

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published