webpack-merge
Advanced tools
Comparing version 0.8.4 to 0.9.0
@@ -0,1 +1,6 @@ | ||
0.9.0 / 2016-04-08 | ||
================== | ||
* Feature: Allow existing objects/arrays to be emptied with an empty object/array later in merge. This overriding behavior is useful for example emptying your `entry` configuration. | ||
0.8.4 / 2016-03-17 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -46,2 +46,6 @@ 'use strict'; | ||
if (!b.length) { | ||
return []; | ||
} | ||
if (customResult) { | ||
@@ -59,2 +63,6 @@ return customResult; | ||
if (isPlainObject(a) && isPlainObject(b)) { | ||
if (!Object.keys(b).length) { | ||
return {}; | ||
} | ||
return merge({}, a, b, joinArrays.bind(null, customizer)); | ||
@@ -61,0 +69,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "0.8.4", | ||
"version": "0.9.0", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "build": "babel src -d lib", |
@@ -40,2 +40,6 @@ const isArray = Array.isArray; | ||
if (!b.length) { | ||
return []; | ||
} | ||
if (customResult) { | ||
@@ -53,2 +57,6 @@ return customResult; | ||
if (isPlainObject(a) && isPlainObject(b)) { | ||
if (!Object.keys(b).length) { | ||
return {}; | ||
} | ||
return merge({}, a, b, joinArrays.bind(null, customizer)); | ||
@@ -55,0 +63,0 @@ } |
38
test.js
@@ -176,2 +176,16 @@ /* eslint-env mocha */ | ||
}); | ||
it('should allow overriding with an empty array in ' + loadersKey, function () { | ||
const a = {}; | ||
a[loadersKey] = [{ | ||
test: /\.js$/, | ||
loaders: ['a?1'] | ||
}]; | ||
const b = {}; | ||
b[loadersKey] = []; | ||
const result = {}; | ||
result[loadersKey] = []; | ||
assert.deepEqual(merge(a, b), result); | ||
}); | ||
} | ||
@@ -549,2 +563,26 @@ | ||
}); | ||
it('should allow overriding with an empty array', function () { | ||
const a = { | ||
entry: ['foo'] | ||
}; | ||
const b = { | ||
entry: [] | ||
}; | ||
assert.deepEqual(merge(a, b), b); | ||
}); | ||
it('should allow overriding with an empty object', function () { | ||
const a = { | ||
entry: { | ||
a: 'foo' | ||
} | ||
}; | ||
const b = { | ||
entry: {} | ||
}; | ||
assert.deepEqual(merge(a, b), b); | ||
}); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26650
670