# is-equal-shallow

> Does a shallow comparison of two objects, returning false if the keys or values differ.

Latest version **0.1.3** (published 2015-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-equal-shallow
pnpm add is-equal-shallow
yarn add is-equal-shallow
bun add is-equal-shallow
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2015-06-23 |
| First published | 2015-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/is-equal-shallow) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | compare, comparison, equal, equals, is, is-equal, key, object, same, shallow, value |

## Links

- npm: https://www.npmjs.com/package/is-equal-shallow
- Repository: https://github.com/jonschlinkert/is-equal-shallow
- Issues: https://github.com/jonschlinkert/is-equal-shallow/issues
- npm.io page: https://npm.io/package/is-equal-shallow

## Dependencies (1)

- [is-primitive](https://npm.io/package/is-primitive.md) ^2.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2015-06-23
- 0.1.2 — 2015-04-14
- 0.1.1 — 2015-02-25
- 0.1.0 — 2015-02-17

## README

# is-equal-shallow [![NPM version](https://badge.fury.io/js/is-equal-shallow.svg)](http://badge.fury.io/js/is-equal-shallow)  [![Build Status](https://travis-ci.org/jonschlinkert/is-equal-shallow.svg)](https://travis-ci.org/jonschlinkert/is-equal-shallow)

> 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, `false` is returned.

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i is-equal-shallow --save
```

## Usage

```js
var equals = require('is-equal-shallow');
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

Other object utils:

* [clone-deep](https://github.com/jonschlinkert/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in)
* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own)
* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null.

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-equal-shallow/issues/new)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 22, 2015._

---
_Source: https://npm.io/package/is-equal-shallow · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
