Skip to content

Commit

Permalink
fix(deep-object-assign): enumarability check (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomaash authored Aug 1, 2020
1 parent c27c5e7 commit 1344751
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/deep-object-assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function deepObjectAssignNonentry(...values: readonly any[]): any {
const b = values[1];

for (const prop of Reflect.ownKeys(b)) {
if (Object.prototype.propertyIsEnumerable.call(b, b[prop])) {
if (!Object.prototype.propertyIsEnumerable.call(b, prop)) {
// Ignore nonenumerable props, Object.assign() would do the same.
} else if (b[prop] === DELETE) {
delete a[prop];
Expand Down
5 changes: 5 additions & 0 deletions test/deep-object-assign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,9 @@ test(deepObjectAssign, (): void => {
id: 0.25,
[SYMBOL_KEY]: 2,
});

given({}, { foo: "bar", deleteFoo: "foo" }).expect({
foo: "bar",
deleteFoo: "foo",
});
});

0 comments on commit 1344751

Please sign in to comment.