# just-compare

> compare two collections

Latest version **2.3.0** (published 2022-12-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install just-compare
pnpm add just-compare
yarn add just-compare
bun add just-compare
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2022-12-17 |
| First published | 2016-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6201 |
| Author | Angus Croll |
| Maintainers | angus-c |
| Keywords | object, array, compare, no-dependencies, just |

## Links

- npm: https://www.npmjs.com/package/just-compare
- Repository: https://github.com/angus-c/just
- Homepage: https://github.com/angus-c/just#readme
- Issues: https://github.com/angus-c/just/issues
- npm.io page: https://npm.io/package/just-compare

## Recent versions

- 2.3.0 (latest) — 2022-12-17
- 2.2.2 — 2022-08-08
- 2.2.1 — 2022-08-07
- 2.2.0 — 2022-08-07
- 2.1.1 — 2022-06-12
- 2.1.0 — 2022-03-19
- 2.0.3 — 2022-03-19
- 2.0.1 — 2021-11-13
- 2.0.0 — 2021-11-09
- 1.5.1 — 2021-11-01
- 1.5.0 — 2021-10-31
- 1.4.0 — 2021-03-27
- 1.3.0 — 2018-08-09
- 1.2.2 — 2018-03-12
- 1.2.1 — 2017-11-10
- … 16 more at https://npm.io/package/just-compare/versions

## README

<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->
<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->

## just-compare

Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.

[`🍦 Try it`](https://anguscroll.com/just/just-compare)

```shell
npm install just-compare
```
```shell
yarn add just-compare
```

Compare two collections

```js
import compare from 'just-compare';

// primitives: value1 === value2
// functions: value1.toString == value2.toString
// arrays: if length, sequence and values of properties are identical
// objects: if length, names and values of properties are identical
compare([1, [2, 3]], [1, [2, 3]]); // true
compare([1, [2, 3], 4], [1, [2, 3]]); // false
compare({a: 2, b: 3}, {a: 2, b: 3}); // true
compare({a: 2, b: 3}, {b: 3, a: 2}); // true
compare({a: 2, b: 3, c: 4}, {a: 2, b: 3}); // false
compare({a: 2, b: 3}, {a: 2, b: 3, c: 4}); // false
compare([1, [2, {a: 4}], 4], [1, [2, {a: 4}]]); // false
compare([1, [2, {a: 4}], 4], [1, [2, {a: 4}], 4]); // true
compare(NaN, NaN); // true
```

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