# value-equal

> Are these two JavaScript values equal?

Latest version **1.0.1** (published 2018-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install value-equal
pnpm add value-equal
yarn add value-equal
bun add value-equal
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-12-03 |
| First published | 2016-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Michael Jackson |
| Maintainers | mjackson |

## Links

- npm: https://www.npmjs.com/package/value-equal
- Repository: https://github.com/mjackson/value-equal
- Homepage: https://github.com/mjackson/value-equal#readme
- Issues: https://github.com/mjackson/value-equal/issues
- npm.io page: https://npm.io/package/value-equal

## Recent versions

- 1.0.1 (latest) — 2018-12-03
- 0.4.1-beta.6 (next) — 2018-12-02
- 1.0.0 — 2018-12-02
- 0.5.3 — 2018-12-02
- 0.5.1 — 2018-12-02
- 0.5.0 — 2018-12-02
- 0.4.1-beta.5 — 2018-12-02
- 0.4.1-beta.4 — 2018-12-02
- 0.4.1-beta.3 — 2018-12-02
- 0.4.1-beta.0 — 2018-12-02
- 0.4.0 — 2017-08-23
- 0.3.0 — 2017-04-21
- 0.2.1 — 2017-04-21
- 0.2.0 — 2016-12-13
- 0.1.1 — 2016-10-27
- … 1 more at https://npm.io/package/value-equal/versions

## README

# value-equal [![Travis][build-badge]][build] [![npm package][npm-badge]][npm]

[build-badge]: https://img.shields.io/travis/mjackson/value-equal/master.svg?style=flat-square
[build]: https://travis-ci.org/mjackson/value-equal
[npm-badge]: https://img.shields.io/npm/v/value-equal.svg?style=flat-square
[npm]: https://www.npmjs.org/package/value-equal

[`value-equal`](https://www.npmjs.com/package/value-equal) determines if two JavaScript values are equal using [`Object.prototype.valueOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf).

In many instances when I'm checking for object equality, what I really want to know is if their **values** are equal. This is good for:

- Stuff you keep in `localStorage`
- `window.history.state` values
- Query strings

## Installation

Using [npm](https://www.npmjs.com/):

    $ npm install --save value-equal

Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else:

```js
// using ES6 modules
import valueEqual from 'value-equal';

// using CommonJS modules
var valueEqual = require('value-equal');
```

The UMD build is also available on [unpkg](https://unpkg.com):

```html
<script src="https://unpkg.com/value-equal"></script>
```

You can find the library on `window.valueEqual`.

## Usage

```js
valueEqual(1, 1); // true
valueEqual('asdf', 'asdf'); // true
valueEqual('asdf', new String('asdf')); // true
valueEqual(true, true); // true
valueEqual(true, false); // false
valueEqual({ a: 'a' }, { a: 'a' }); // true
valueEqual({ a: 'a' }, { a: 'b' }); // false
valueEqual([1, 2, 3], [1, 2, 3]); // true
valueEqual([1, 2, 3], [2, 3, 4]); // false
```

That's it. Enjoy!

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