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

Add support for react-native #134

Closed xanderberkein closed 6 years ago

xanderberkein commented 6 years ago

This package (v1.0.1) fails to initialize as a dependency of a react-native project.

I added a check that initializes deepDiff correctly when the package gets run in a react-native context.

  } else if (typeof exports === 'object' || typeof navigator === 'object' && navigator.product.match(/ReactNative/i)) {
      // Node.js or ReactNative
      module.exports = deepDiff;
xanderberkein commented 6 years ago

There still seem to be some problems, I'll investigate this further

xanderberkein commented 6 years ago

React-native support works now with the changes of PR 138 merged into this one. I didn't notice the other usage of root in the package.

I added a build as well, since I'm using this in my react-native app. I can remove the build again if you wish.