# jsdiff

> diff objects

Latest version **1.1.1** (published 2014-10-23) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2014-10-23 |
| First published | 2014-04-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Nathan Zadoks |
| Maintainers | nathan7 |
| Keywords | diff, object, utility |

## Links

- npm: https://www.npmjs.com/package/jsdiff
- Repository: https://github.com/nathan7/jsdiff
- Issues: https://github.com/nathan7/jsdiff/issues
- npm.io page: https://npm.io/package/jsdiff

## Dependencies (1)

- [is-equal](https://npm.io/package/is-equal.md) ~0.1.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2014-10-23
- 1.1.0 — 2014-04-11
- 1.0.1 — 2014-04-11
- 1.0.0 — 2014-04-11

## README

# jsdiff

  diff values

## Installation

    npm install jsdiff

## API
### diff(a, b)

  returns an object with truthy values for stuff that changed.

  `diff({ a: 'foo' }, {})` -> `{ a: true }`

  `diff({ a: 'foo' }, { a: 'bar' })` -> `{ a: true }`

  `diff({ a: 'foo' }, { b: 'bar' })` -> `{ a: true, b: true }`

  `diff({}, { b: 'foo' })` -> `{ b: true }`

  `diff({ a: { b: 'foo'} }, { b: 'bar' })` -> `{ a: { b: true }, b: true }`

  `diff([1, 2, 3], [1, 2, 4])` -> `[ , , true ]`

### diff.patch(d, b, model)

  patch up a model using a diff.

```js
var a = { a: 'foo' }
  , b = { b: 'bar', c: { deep: 'stuff' } }
diff.patch(diff(a, b), b,
  { set: console.log.bind(console, 'set')
  , delete: console.log.bind(console, 'delete')
  })
```

  output:

```
delete [ 'a' ]
set [ 'b' ] bar
set [ 'c', 'deep' ] stuff
```

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