Skip to content

Commit

Permalink
feat(config): allow overwriting configuration
Browse files Browse the repository at this point in the history
Small change in deepmerge.js to allow the user, or any plugin, to
completely overwrite a configuration object, by prefixing the config
key with `(replace)`.
  • Loading branch information
Merott committed May 16, 2014
1 parent cf0c124 commit 9ff0818
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/deepmerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ return function deepmerge(target, src) {
})
}
Object.keys(src).forEach(function (key) {
if (typeof src[key] !== 'object' || !src[key]) {
if(key.indexOf('(replace)') === 0) {
dst[key.substr(9)] = src[key];
}
else if (typeof src[key] !== 'object' || !src[key]) {
dst[key] = src[key];
}
else {
Expand Down

0 comments on commit 9ff0818

Please sign in to comment.