Does a shallow comparison of two objects, returning false if the keys or values differ.
The purpose of this lib is to do the fastest comparison possible of two objects when the values will predictably be primitives.
- only compares objects.
- only compares the first level of each object
- values must be primitives. If a value is not a primitive, even if the values are the same,
Install with npm
$ npm i is-equal-shallow --save
var equals = ;;
;//=> 'true';//=> 'false';//=> 'false'
Strict comparison for equality:
When values are not primitives,
false is always returned:
;//=> 'false';//=> 'false'
Other object utils:
- for-in: Iterate over the own and inherited enumerable properties of an objecte, and return an object… more
- for-own: Iterate over the own enumerable properties of an object, and return an object with properties… more
- is-plain-object: Returns true if an object was created by the
- isobject: Returns true if the value is an object and not an array or null.
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on June 22, 2015.