flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use the diff functionality out of a browser

juanBLUE opened this issue · comments

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.

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).

This works.

Would be nice to include an example in the README:

import diff from 'deep-diff';

And close ticket?

It's in the latest readme.