# comparify

> Simple criteria checking, so you can test a subset of an object's properties.

Latest version **0.2.0** (published 2014-06-01) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2014-06-01 |
| First published | 2014-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Carson Darling |
| Maintainers | carsondarling |
| Keywords | compare, search, criteria |

## Links

- npm: https://www.npmjs.com/package/comparify
- Repository: https://github.com/mimobaby/comparify
- Issues: https://github.com/mimobaby/comparify/issues
- npm.io page: https://npm.io/package/comparify

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2014-06-01
- 0.1.0 — 2014-03-27

## README

#Comparify

Simple criteria checking, so you can test a subset of an object's properties.

```
var comparify = require('comparify');

var data = {
  timestamp: 1395877795067,
  deviceID: '765CBA',
  recipient: {
    name: 'Thomas'
  },
  uses: ['making pancakes', 'running', 'hugs']
};

comparify(data, {deviceID: '765CBA'}) === true;
comparify(data, {deviceID: 'ABC123'}) === false;

// Comparify also supports nested requirements
comparify(data, {'recipient.name': 'Thomas'}) === true;
comparify(data, {recipient: {name: 'Thomas'}}) === true;

// And you can look in arrays
comparify(data, {uses: 'running'}) === true;
comparify(data, {uses: 'skiing'}) === false;

// You can require that multiple values are present in an array
comparify(data, {uses: ['running', 'hugs']}) === true;
comparify(data, {uses: ['running', 'skiing']}) === false;

// And you can use a Regex for values
comparify(data, {'recipient.name': /omas/}) === true;


```

## To Do

- [x] Add support for arrays (any / all matching)
- [x] Add support for regex comparison
- [ ] Add support for more types of comparison
  - [ ] Greater than / less than
  - [ ] Range

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