value-equal
value-equal determines if two JavaScript values are equal using Object.prototype.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
localStoragewindow.history.statevaluesQuery strings
Installation
Using npm:
$ npm install --save value-equalThen with a module bundler like webpack, 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 unpkg:
<script src="https://unpkg.com/value-equal"></script>You can find the library on window.valueEqual.
Usage
That's it. Enjoy!
Last updated
Was this helpful?