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

Use the diff functionality out of a browser #117

Closed juanBLUE closed 6 years ago

juanBLUE commented 6 years ago

Hi,

Is there any way of using this functionality in a standalone Javascript environment? I´d like to use it in a script and don´t know what js files should I import to just call:

var differences = diff(obj1, obj2);

Apart from this, would it be any license problem using the diff module this way?

Thanks.

Regards.

flitbit commented 6 years ago

You can install the script into any environment that supports NPM modules and use it by reference:

Install

npm install deep-diff

Import

This part will differ depending on your run-time environment, but usually is:

let diff = require('deep-diff');

If you want to use the module by itself, just reference index.es.js if you're using an ES6 compatible environment, otherwise reference index.js. The entire module is contained in that one file(s).

Izhaki commented 6 years ago

This works.

Would be nice to include an example in the README:

import diff from 'deep-diff';

And close ticket?

flitbit commented 6 years ago

It's in the latest readme.