1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
# {%= name %} {%= badge("fury") %} {%= badge("travis") %}
> {%= description %}
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, `false` is returned.
{%= include("install-npm", {save: true}) %}
## Usage
```js
var equals = require('{%= name %}');
equals(object_a, object_b);
```
**Examples**
```js
equals({a: true, b: true}, {a: true, b: true});
//=> 'true'
equals({a: true, b: false}, {c: false, b: false});
//=> 'false'
equals({a: true, b: false}, {a: false, b: false});
//=> 'false'
```
Strict comparison for equality:
```js
equals({a: true, b: true}, {a: true, b: 'true'});
//=> 'false'
```
When values are not primitives, `false` is always returned:
```js
equals({ b: {}}, { b: {}});
//=> 'false'
equals({ b: []}, { b: []});
//=> 'false'
```
## Related projects
{%= verbiage.related.description %}
{%= related(verbiage.related.list) %}
## Running tests
{%= include("tests") %}
## Contributing
{%= include("contributing") %}
## Author
{%= include("author") %}
## License
{%= copyright() %}
{%= license() %}
***
{%= include("footer") %}
|