flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

Fix the case when this/root is undefined #138

Closed KidkArolis closed 6 years ago

KidkArolis commented 6 years ago

Some combination of webpack and babel sometimes rewrites this to void 0:

image

Why is this line root.DeepDiff = accumulateDiff; needed at all, could it be removed?

KidkArolis commented 6 years ago

The reason I ask is because for the browser case there's already a root.DeepDiff = deepDiff; on line 21, I don't think we need the one at the bottom of the module.

xanderberkein commented 6 years ago

Thanks, this is what I needed to make this package 100% compatible with react-native. I didn't notice the use root there earlier.

I pulled your PR into mine: https://github.com/flitbit/diff/pull/134

KidkArolis commented 6 years ago

@flitbit thanks for merging. I see the 1.0.2 tag in github, but it's not on npm?

flitbit commented 6 years ago

Yeah, didn't change the NPM token on the CI server, my bad. Should be published now.