# variable-diff

> Visual diff between javascript variables

Latest version **2.0.2** (published 2020-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install variable-diff
pnpm add variable-diff
yarn add variable-diff
bun add variable-diff
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-09-01 |
| First published | 2016-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 33 |
| Author | Taylor Hakes |
| Maintainers | taylorhakes |
| Keywords | diff, visual, json, object, variable, difference, changes, javascript |

## Links

- npm: https://www.npmjs.com/package/variable-diff
- Repository: https://github.com/taylorhakes/variable-diff
- Homepage: https://github.com/taylorhakes/variable-diff#readme
- Issues: https://github.com/taylorhakes/variable-diff/issues
- npm.io page: https://npm.io/package/variable-diff

## Dependencies (1)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.2 (latest) — 2020-09-01
- 2.0.1 — 2019-09-25
- 2.0.0 — 2019-09-25
- 1.1.0 — 2016-02-10
- 1.0.0 — 2016-02-06

## 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](https://travis-ci.org/taylorhakes/variable-diff.svg?branch=master)](https://travis-ci.org/taylorhakes/variable-diff)

![Screenshot](.github/screenshot.png)

## Use
```
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)
```


### Test
```
npm test
```

---
_Source: https://npm.io/package/variable-diff · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
