# 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!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bryan-guner.gitbook.io/my-docs/redux/repos/examples/real-world/node_modules/value-equal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
