Visual diff between javascript variables
npm install variable-diff
npm install variable-diff
``js
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)
`
$3
`
npm test
``