From 4ef3061cd665564035e0decf45a69b40cb825bb4 Mon Sep 17 00:00:00 2001 From: Daniel Loomer Date: Thu, 3 Oct 2019 15:53:52 -0400 Subject: [PATCH] when copying source object also copy prototype --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b248223..f61d909 100644 --- a/src/index.js +++ b/src/index.js @@ -20,7 +20,7 @@ const run = (isArr, copy, patch) => { const merge = (source, ...patches) => { const isArr = Array.isArray(source) - return run(isArr, isArr ? source.slice() : assign({}, source), patches) + return run(isArr, isArr ? source.slice() : assign(Object.create(Object.getPrototypeOf(source)), source), patches) } export default merge