# jsdiff-console

> Compares JS hashes using JsDiff and outputs the result on the console

Latest version **3.0.1** (published 2019-07-14) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install jsdiff-console
pnpm add jsdiff-console
yarn add jsdiff-console
bun add jsdiff-console
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2019-07-14 |
| First published | 2016-01-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kevin Goslar |
| Maintainers | kevingoslar |

## Links

- npm: https://www.npmjs.com/package/jsdiff-console
- Repository: https://github.com/kevgo/jsdiff-console
- Homepage: https://github.com/kevgo/jsdiff-console#readme
- Issues: https://github.com/kevgo/jsdiff-console/issues
- npm.io page: https://npm.io/package/jsdiff-console

## Dependencies (2)

- [diff](https://npm.io/package/diff.md) 4.0.1
- [chalk](https://npm.io/package/chalk.md) 2.4.2

## Recent versions

- 3.0.1 (latest) — 2019-07-14
- 3.0.0 — 2019-07-14
- 2.2.1 — 2016-06-01
- 2.2.0 — 2016-05-31
- 2.1.0 — 2016-05-29
- 2.0.0 — 2016-05-27
- 1.4.2 — 2016-05-15
- 1.4.1 — 2016-05-15
- 1.4.0 — 2016-05-13
- 1.3.0 — 2016-02-19
- 1.2.1 — 2016-02-11
- 1.2.0 — 2016-02-11
- 1.1.3 — 2016-01-21
- 1.1.2 — 2016-01-21
- 1.1.1 — 2016-01-21
- … 3 more at https://npm.io/package/jsdiff-console/versions

## README

# JsDiff with console output

> Compares JS hashes using JsDiff and outputs the result on the console

[![CircleCI](https://circleci.com/gh/kevgo/jsdiff-console.svg?style=shield)](https://circleci.com/gh/kevgo/jsdiff-console)
[![Coverage Status](https://coveralls.io/repos/github/kevgo/jsdiff-console/badge.svg?branch=master)](https://coveralls.io/github/kevgo/jsdiff-console?branch=master)
[![Dependency Status](https://david-dm.org/kevgo/jsdiff-console.svg)](https://david-dm.org/kevgo/jsdiff-console)
[![devDependency Status](https://david-dm.org/kevgo/jsdiff-console/dev-status.svg)](https://david-dm.org/kevgo/jsdiff-console#info=devDependencies)

This is a very simple helper method for printing the differences between two
JSON or string variables to the console, for example in unit tests. It wraps the
excellent [diff](https://github.com/kpdecker/jsdiff) module.

```javascript
jsdiff = require("jsdiff-console")

// compare objects
jsdiff.json(actualJson, expectedJson)

// compare strings and highlight the differences character-by-character
jsdiff.chars(actualString, expectedString)

// compare strings and highlight the mismatching words, whitespace-sensitive
jsdiff.wordsWithSpace(actualString, expectedString)

// compare strings and highlight the mismatching lines, ignoring whitespace around them
jsdiff.trimmedLines(actualString, expectedString)
```

If the two given values are different, the `jsdiff` methods throw an error with
a console-formatted message. This will cause your test runtime to fail the
current unit test and print a nicely readable diff of your objects.

You can provide a custom error message as an optional third parameter.

## Development

- run all tests: `make test`
- update dependencies: `make update`
- see all available make commands: `make help`
- deploy a new version:
  - commit an update with new version in `package.json` on master
  - run `npm publish`

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