variable-diff
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

variable-diff

Visual diff between 2 javascript variables. Shows only the difference and ignores keys that are the same. Diff is formatted in an easy to read format.

Build Status

Screenshot

Use

npm install variable-diff
var diff = require('variable-diff');
 
var result = diff({ a: 1, b: 2, d: 'hello' }, { a: 8, b: 2, c: 4});
console.log(result.text);
 
// You can pass all or some of these options
var defaultOptions = {
  indent: '  ',
  newLine: '\n',
  wrap: function wrap(type, text) {
    return chalk[typeColors[type]](text);
  },
  color: true
};
 
diff({ a: 1, b: 2, d: 'hello' }, { a: 8, b: 2, c: 4}, defaultOptions)

Test

npm test

/variable-diff/

    Package Sidebar

    Install

    npm i variable-diff

    Weekly Downloads

    59,894

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    23.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • taylorhakes