# shallowequal

> Like lodash isEqualWith but for shallow equal.

Latest version **1.1.0** (published 2018-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install shallowequal
pnpm add shallowequal
yarn add shallowequal
bun add shallowequal
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-06-23 |
| First published | 2015-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/shallowequal) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 167 |
| Author | Alberto Leal |
| Maintainers | dashed |
| Keywords | shallowequal, shallow, equal, isequal, compare, isequalwith |

## Links

- npm: https://www.npmjs.com/package/shallowequal
- Repository: https://github.com/dashed/shallowequal
- Homepage: https://github.com/dashed/shallowequal#readme
- Issues: https://github.com/dashed/shallowequal/issues
- npm.io page: https://npm.io/package/shallowequal

## Recent versions

- 1.1.0 (latest) — 2018-06-23
- 1.0.2 — 2017-07-10
- 1.0.1 — 2017-05-23
- 1.0.0 — 2017-05-22
- 0.2.2 — 2015-08-17
- 0.2.1 — 2015-06-20
- 0.2.0 — 2015-06-12
- 0.1.0 — 2015-06-12

## README

# shallowequal [![Build Status](https://travis-ci.org/dashed/shallowequal.svg)](https://travis-ci.org/dashed/shallowequal) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)

[![Greenkeeper badge](https://badges.greenkeeper.io/dashed/shallowequal.svg)](https://greenkeeper.io/)

> `shallowequal` is like lodash's [`isEqualWith`](https://lodash.com/docs/4.17.4#isEqualWith) but for shallow (strict) equal.

`shallowequal(value, other, [customizer], [thisArg])`

Performs a ***shallow equality*** comparison between two values (i.e. `value` and `other`) to determine if they are equivalent.

The equality is performed by iterating through keys on the given `value`, and returning `false` whenever any key has values which are not **strictly equal** between `value` and `other`. Otherwise, return `true` whenever the values of all keys are strictly equal.

If `customizer` (expected to be a function) is provided it is invoked to compare values. If `customizer` returns `undefined` (i.e. `void 0`), then comparisons are handled by the `shallowequal` function instead.

The `customizer` is bound to `thisArg` and invoked with three arguments: `(value, other, key)`.

**NOTE:** Docs are (shamelessly) adapted from [lodash's v3.x docs](https://lodash.com/docs/3.10.1#isEqualWith)

## Install

```sh
$ yarn add shallowequal
# npm v5+
$ npm install shallowequal
# before npm v5
$ npm install --save shallowequal
```

## Usage

```js
const shallowequal = require('shallowequal');

const object = { 'user': 'fred' };
const other = { 'user': 'fred' };

object == other;
// → false

shallowequal(object, other);
// → true
```

## Credit

Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).

## Development

- `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
- `yarn`. See: https://yarnpkg.com/en/docs/install
- `npm` dependencies. Run: `yarn install`

### Chores

- Lint: `yarn lint`
- Test: `yarn test`
- Pretty: `yarn pretty`
- Pre-publish: `yarn prepublish`

## License

MIT.

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