githubEdit

value-equal

value-equalarrow-up-right determines if two JavaScript values are equal using Object.prototype.valueOfarrow-up-right.

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 npmarrow-up-right:

$ npm install --save value-equal

Then with a module bundler like webpackarrow-up-right, use as you would anything else:

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

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

The UMD build is also available on unpkgarrow-up-right:

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

You can find the library on window.valueEqual.

Usage

That's it. Enjoy!

Last updated