concat-merge
v1.2.0
Published
Recursively merge objects
Downloads
26,208
Readme
concat-merge
Recursively merge objects, especially for webpack/rollup configs.
Comparison
| name | immutable | concat | dedupe | clone | multiple parameters | recommended |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ---------------- | ---------------- | ---------------- | ------------------- | ----------- |
| concat-merge | true
| true
| false
| true
| no | yes |
| merge-deep | true
| true
| true
| true
| yes | yes |
| deepmerge | true
| true
| false
| false
(option) | no | |
| lodash/merge | false
| false
| false
| true
| yes | |
| lodash/mergeWith | false
| false
(option) | false
(option) | true
| yes | yes |
Install
npm install concat-merge
Usage
import concatMerge from 'concat-merge'
concatMerge(baseConfig, {
input: 'entry.js',
plugins: [inject({React: 'react'})],
})
lodash equivalent:
import mergeWith from 'lodash/mergeWith'
const concatMerge = (...args) =>
mergeWith({}, ...args, (prev, next) => {
if (Array.isArray(prev)) {
return prev.concat(next)
}
})