# chai-shallow-deep-equal

> Shallow deep equal assertion for chai

Latest version **1.4.6** (published 2017-03-15) · 0 weekly downloads

## Install

```sh
npm install chai-shallow-deep-equal
pnpm add chai-shallow-deep-equal
yarn add chai-shallow-deep-equal
bun add chai-shallow-deep-equal
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.6 |
| Published | 2017-03-15 |
| First published | 2014-06-11 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 0.6.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Michel Salib |
| Maintainers | michelsalib |
| Keywords | chai, chai-plugin, browser, objects, test, assertion, assert, testing, shallow, deep |

## Links

- npm: https://www.npmjs.com/package/chai-shallow-deep-equal
- Repository: https://github.com/michelsalib/chai-shallow-deep-equal
- Homepage: https://github.com/michelsalib/chai-shallow-deep-equal#readme
- Issues: https://github.com/michelsalib/chai-shallow-deep-equal/issues
- npm.io page: https://npm.io/package/chai-shallow-deep-equal

## 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
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.4.6 (latest) — 2017-03-15
- 1.4.4 — 2016-09-28
- 1.4.3 — 2016-09-28
- 1.4.2 — 2016-09-28
- 1.4.1 — 2016-09-28
- 1.4.0 — 2016-02-19
- 1.3.0 — 2015-02-25
- 1.2.0 — 2015-02-19
- 1.1.0 — 2015-02-04
- 1.0.0 — 2014-10-07
- 0.0.3 — 2014-06-16
- 0.0.2 — 2014-06-11
- 0.0.1 — 2014-06-11

## README

# chai-shallow-deep-equal

Will shallowly perform a deep equal assertion. In other terms is consist of checking that an object, or objects graph, is contained within another one (see examples bellow).

[![NPM version](https://badge.fury.io/js/chai-shallow-deep-equal.png)](http://badge.fury.io/js/chai-shallow-deep-equal)
[![Build Status](https://travis-ci.org/michelsalib/chai-shallow-deep-equal.png?branch=master)](https://travis-ci.org/michelsalib/chai-shallow-deep-equal)

## Usage

### Browser

```html
<script src="chai.js"></script>
<script src="chai-shallow-deep-equal.js"></script>
```

### Node

```javascript
var chai = require('chai');
chai.use(require('chai-shallow-deep-equal'));
```

## Assertions

ShallowDeepEqual is available for all chai assertion styles:

```javascript
var a = {name: 'Michel', language: 'javascript'};
var b = {name: 'Michel'};

a.should.shallowDeepEqual(b);
expect(a).to.shallowDeepEqual(b);
assert.shallowDeepEqual(a, b);
```

## Example

```javascript
assert.shallowDeepEqual({name: 'Michel', language: 'javascript'}, {name: 'Michel'}); // true

assert.shallowDeepEqual({
  name: 'Michel',
  language: 'javascript',
  tags: [
    'developer',
    'gamer'
  ]},
  {
  name: 'Michel',
  tags: [
    'developer'
  ]}); // true

assert.shallowDeepEqual([
    {brand: 'apple', color: 'red'},
    {brand: 'samsung', color: 'blue'},
  ],
  {
  length: 2,
  0: {color: 'red'},
  1: {brand: 'samsung'},
  }); // true

assert.shallowDeepEqual({
  name: 'Michel',
  age: undefined
  },
  {
  name: 'Michel',
  age: 37
  }); // false (age should not be defined)
```

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