variable-diff
Visual diff between javascript variables
Last updated 11 years ago by taylorhakes .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install variable-diff 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.2                                ...           latest (6 years ago)

5 Versions

  • 2.0.2                                ...           6 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 25
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 5
Last Month 5
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE