# chai-public-equal

> "publicEqual" is an object properties matcher for [Chai](http://chaijs.com/) assertion library

Latest version **5.1.2** (published 2015-10-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install chai-public-equal
pnpm add chai-public-equal
yarn add chai-public-equal
bun add chai-public-equal
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.2 |
| Published | 2015-10-15 |
| First published | 2015-07-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Viktor Somodi |
| Maintainers | sviktor, draven |

## Links

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

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^3.10.0
- [deep-equal](https://npm.io/package/deep-equal.md) ^1.0.0
- [is-native-type](https://npm.io/package/is-native-type.md) ^1.0.3
- [getallpropertynames](https://npm.io/package/getallpropertynames.md) ^0.1.3

## Recent versions

- 5.1.2 (latest) — 2015-10-15
- 5.1.1 — 2015-10-14
- 5.1.0 — 2015-09-19
- 5.0.0 — 2015-09-19
- 4.1.1 — 2015-09-16
- 4.1.0 — 2015-08-24
- 4.0.5 — 2015-08-23
- 4.0.4 — 2015-08-23
- 4.0.3 — 2015-08-04
- 4.0.2 — 2015-07-31
- 4.0.1 — 2015-07-30
- 4.0.0 — 2015-07-30
- 2.0.1 — 2015-07-30
- 2.0.0 — 2015-07-29
- 1.0.2 — 2015-07-28
- … 2 more at https://npm.io/package/chai-public-equal/versions

## README

# chai-public-equal 

"publicEqual" is an object properties matcher for [Chai](http://chaijs.com/) assertion library

This plugin use https://www.npmjs.com/package/deep-equal to check equality. Before compare it removes the private properties based on the given patterns.
The default pattern is /^_.+/ 

Installation
===========

`npm install --save-dev chai-public-equal`

Usage
=====

```js
var chai = require('chai');
var chaiPublicEqual = require('chai-public-equal');
chai.use(chaiPublicEqual());
```

Public Equal check
=====
in your spec.js
```js
var obj = {
	a: 'b',
	c: 'd',
	_d: 'private_value',
	e: {
	  f: 1,
	  _g: 2
	}
};
	
expect(obj).to.publicEql({
	a: 'b',
	c: 'd',
	_d: 'other_private_value',
	e: {
	  f: 1,
	  _h: 9
  }	  
});
//or with 'not'
expect(obj).to.not.publicEql({
	h: 'b'
});
```

Contain publics check
=====
in your spec.js
```js
var obj = {
	a: 'b',
	c: 'd',
	_d: 'private_value',
};
	
expect(obj).to.containPublics({
	a: 'b',
	_d: 'other_private_value'
});

//or with 'not'
expect(obj).to.not.containPublics({
	h: 'b'
});
```


Custom patterns for public property name checking
=====

`chai.use(chaiPublicEqual([/^_.+/, /^should/]));`

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