# shallow-equals

> Determine if an array or object is equivalent with another, *not* recursively

Latest version **1.0.0** (published 2017-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install shallow-equals
pnpm add shallow-equals
yarn add shallow-equals
bun add shallow-equals
```

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-02-12 |
| First published | 2014-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/shallow-equals) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hugh Kennedy |
| Maintainers | hughsk |
| Keywords | shallow, equals, compare, equality, check, test |

## Links

- npm: https://www.npmjs.com/package/shallow-equals
- Repository: https://github.com/hughsk/shallow-equals
- Issues: https://github.com/hughsk/shallow-equals/issues
- npm.io page: https://npm.io/package/shallow-equals

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-02-12
- 0.0.1 — 2017-02-12
- 0.0.0 — 2014-02-26

## README

# shallow-equals [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/shallow-equals&title=shallow-equals&description=hughsk/shallow-equals%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #

Determine if an array or object is equivalent with another, *not* recursively.

## Usage ##

[![shallow-equals](https://nodei.co/npm/shallow-equals.png?mini=true)](https://nodei.co/npm/shallow-equals)

### `equals(a, b, [compare])` ###

Check if `a` and `b` are pretty much the same thing. Note this won't be the
case if `a` and `b` are different types (e.g. Array vs. Object, String vs.
Function).

By default, all comparisons between values are using the strict equality
(`===`) operator. You can also pass in a custom `compare` function to override
this behavior.

``` javascript
var equals = require('shallow-equals')

// true:
equals([1, 2, 3], [1, 2, 3])

// true:
equals({ hello: 'world' }, { hello: 'world' })

// false:
equals([1, 2, {}], [1, 2, {}])

// true:
equals([1, 2], [
  { value: 1 },
  { value: 2 }
], function(a, b) {
  return a === b.value
})
```

## License ##

MIT. See [LICENSE.md](http://github.com/hughsk/shallow-equals/blob/master/LICENSE.md) for details.

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