Skip to content

Commit

Permalink
fix!: deepmerge of nothing now returns undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Sep 13, 2021
1 parent f1c4ba8 commit e7a2ade
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/deepmerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function deepmerge(
...objects: Readonly<ReadonlyArray<unknown>>
): unknown {
if (objects.length === 0) {
return {};
return undefined;
}
if (objects.length === 1) {
return objects[0];
Expand Down
4 changes: 2 additions & 2 deletions tests/deepmerge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import test from "ava";

import { deepmerge } from "../src/deepmerge";

test("return an empty object when nothing to merge", (t) => {
test("return undefined when nothing to merge", (t) => {
const merged = deepmerge();
t.deepEqual(merged, {});
t.is(merged, undefined);
});

test("return the same object if only 1 is passed", (t) => {
Expand Down

0 comments on commit e7a2ade

Please sign in to comment.