# compareme

> Library to compare objects

Latest version **1.0.6** (published 2020-02-16) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.6 |
| Published | 2020-02-16 |
| First published | 2019-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 76.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Castro Fernández |
| Maintainers | castrofernandez |

## Links

- npm: https://www.npmjs.com/package/compareme
- Repository: https://github.com/castrofernandez/compareme
- Homepage: https://github.com/castrofernandez/querystringme#readme
- Issues: https://github.com/castrofernandez/querystringme/issues
- npm.io page: https://npm.io/package/compareme

## Dependencies (1)

- [whatsme](https://npm.io/package/whatsme.md) ^1.0.4

## Recent versions

- 1.0.6 (latest) — 2020-02-16
- 1.0.5 — 2020-02-15
- 1.0.4 — 2019-03-25
- 1.0.3 — 2019-03-24
- 1.0.2 — 2019-03-24
- 1.0.1 — 2019-03-24
- 1.0.0 — 2019-03-24

## README

# compareme
Library to compare objects

1. Install 

```
npm install compareme
```

2. Usage

```
import compareme from 'compareme';

compareme.is({a: 1}).like({a: 2}); // true
compareme.is({a: 1, b: 2}).deeply.like({a: 3}) // true
compareme.is({a: 1}).strictly.like({a: 2, b: 3}) // false
compareme.get([10]).strictly.and.deeply.difference.with(['Something']);
/*
{
    success: false,
    differences: [{
        index: '0',
        first: 'number',
        second: 'string',
    }],
}
*/
compareme.get({a: 1, b: {c: 2}}).unexpected.elements.strictly.and.deeply.with({a: 2, b: {d: 's'}});
/*
[{
    index: 'b.d',
    first: 'undefined',
    second: 'string',
}]

compareme.get({a: 1, b: {c: 2}}).missing.elements.strictly.and.deeply.with({a: 2, b: {d: 's'}});

compareme.get({a: 1, b: {c: 2}}).type.differences.strictly.and.deeply.with({a: 2, b: {c: 's'}});
*/
```

3. Development

```
npm run dev
```

This watches files and compiles them

4. Run tests

```
npm test
```

`npm run dev` should be running to watch and recompile files.

5. List of methods

* Start methods:
  * is(object): returns a boolean at the end of the chain.
  * get(object): returns an object with the boolean result of the chain and a list of differences.

* Modifiers:
  * not: negates the condition.
  * deeply: checks first object deeply. Values in second object could not exist.
  * strictly: checks first object deeply and values must match. Second object could not have different values.
  * and

* Finish methods:
  * like: compares the type of each pair of objects.

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