Skip to content

Commit

Permalink
fix: Allow overriding an object field with null
Browse files Browse the repository at this point in the history
Closes #144.
  • Loading branch information
bebraw committed Aug 18, 2020
1 parent 2e8780e commit 4eb811c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.1.2 / 2020-08-18

- Fix - Allow overriding an object field with `null` #144

## 5.1.1 / 2020-08-04

- Fix - Drop `<reference types="webpack-dev-server" />` from **index.d.ts** #143
Expand Down
4 changes: 4 additions & 0 deletions src/join-arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@ function isFunction(functionToCheck) {
}

function isPlainObject(a) {
if (a === null) {
return false;
}

return typeof a === "object";
}
14 changes: 14 additions & 0 deletions test/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ function normalMergeTest(merge, loadersKey) {
assert.deepEqual(merge([]), {});
});

it.only("should override with null (#144)", function () {
const result = { devServer: null };

assert.deepEqual(
merge(
{
devServer: { base: true },
},
result
),
result
);
});

it("should error on promise", function () {
const a = {
module: {},
Expand Down

0 comments on commit 4eb811c

Please sign in to comment.