From 9b9b8041d577ba8a8dd1f4ab1e79333ee6d53a5f Mon Sep 17 00:00:00 2001 From: Karolis Narkevicius Date: Wed, 1 Aug 2018 11:22:18 +0100 Subject: [PATCH] Fix the case when this/root is undefined --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ecca3b4..be3ec94 100644 --- a/index.js +++ b/index.js @@ -518,6 +518,9 @@ // const DeepDiff = require('deep-diff'); // const { DeepDiff } = require('deep-diff'); - root.DeepDiff = accumulateDiff; + if (root) { + root.DeepDiff = accumulateDiff; + } + return accumulateDiff; }));