JSPM

variable-diff

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 68205
  • Score
    100M100P100Q146334F
  • License MIT

Visual diff between javascript variables

Package Exports

  • variable-diff

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (variable-diff) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

Use

npm install variable-diff
var diff = require('variable-diff');

var defaultOptions = {
  indent: '  ',
  newLine: '\n',
  wrap: function wrap(type, text) {
    return chalk[typeColors[type]](text);
  },
  color: true
};

var result = diff({ a: 1, b: 2, d: 'hello' }, { a: 8, b: 2, c: 4}, defaultOptions);
console.log(result.text);

Test

npm test