Skip to content

Commit 1344751

Browse files
authored
fix(deep-object-assign): enumarability check (#465)
1 parent c27c5e7 commit 1344751

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/deep-object-assign.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function deepObjectAssignNonentry(...values: readonly any[]): any {
8282
const b = values[1];
8383

8484
for (const prop of Reflect.ownKeys(b)) {
85-
if (Object.prototype.propertyIsEnumerable.call(b, b[prop])) {
85+
if (!Object.prototype.propertyIsEnumerable.call(b, prop)) {
8686
// Ignore nonenumerable props, Object.assign() would do the same.
8787
} else if (b[prop] === DELETE) {
8888
delete a[prop];

test/deep-object-assign.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,9 @@ test(deepObjectAssign, (): void => {
245245
id: 0.25,
246246
[SYMBOL_KEY]: 2,
247247
});
248+
249+
given({}, { foo: "bar", deleteFoo: "foo" }).expect({
250+
foo: "bar",
251+
deleteFoo: "foo",
252+
});
248253
});

0 commit comments

Comments
 (0)