Skip to content
Myr

Merge pull request #81 from iruca3/fix/treating_constructor_on_proxy

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixed treating constructor on proxy

authored by Michel Weststrate · committed by GitHub · parents 2e8864f, 598080b · Browse files · 2 files+15 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−1 removed

  • tests:+13 added−0 removed
  • other:+2 added−1 removed

2 files+15 added−1 removed

modified:__tests__/base.js+13 added
553 unmodified lines
554 arr: [{count: 1}]555 })556 })557558 it("should handle constructor correctly", () => {559 const base = {560 arr: new Array(),561 obj: new Object()562 }563 const result = produce(base, draft => {564 draft.arrConstructed = draft.arr.constructor(1)565 draft.objConstructed = draft.obj.constructor(1)566 })567 expect(result.arrConstructed).toEqual(new Array().constructor(1))568 expect(result.objConstructed).toEqual(new Object().constructor(1))569 })570571 it("should handle dates correctly", () => {572 const data = {date: new Date()}573 const next = produce(data, draft => {574 draft.x = true
176 unmodified lines
modified:src/proxy.js+2 added-1 removed