# compare-properties

> Get functions to compare two object properties given an operator.

Latest version **1.0.3** (published 2015-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install compare-properties
pnpm add compare-properties
yarn add compare-properties
bun add compare-properties
```

## 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.3 |
| Published | 2015-06-20 |
| First published | 2015-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nicolas Gryman |
| Maintainers | ngryman |
| Keywords | comparator, compare, function, operator, properties |

## Links

- npm: https://www.npmjs.com/package/compare-properties
- Repository: https://github.com/ngryman/compare-properties
- Homepage: https://github.com/ngryman/compare-properties#readme
- Issues: https://github.com/ngryman/compare-properties/issues
- npm.io page: https://npm.io/package/compare-properties

## Recent versions

- 1.0.3 (latest) — 2015-06-20
- 1.0.2 — 2015-06-01
- 1.0.1 — 2015-06-01
- 1.0.0 — 2015-06-01

## README

# compare-properties [![npm][npm-image]][npm-url] [![travis][travis-image]][travis-url]

[npm-image]: https://img.shields.io/npm/v/compare-properties.svg?style=flat
[npm-url]: https://npmjs.org/package/compare-properties
[travis-image]: https://img.shields.io/travis/ngryman/compare-properties.svg?style=flat
[travis-url]: https://travis-ci.org/ngryman/compare-properties

> Get functions to compare two values given an operator.


## Install

```
$ npm install —save compare-properties
```


## Usage

```js
var compareFactory = require('compare-properties');

var equal = compareFactory('=', 'foo');
equal({ foo: 42 }, { foo: 42 }); //=> true
equal({ foo: 42 }, { foo: 10 }); //=> false
equal({ foo: 42 }, { bar: 42 }); //=> false

var equal = compareFactory('=', 'foo', 'bar');
equal({ foo: 42 }, { foo: 42 }); //=> false
equal({ foo: 42 }, { bar: 42 }); //=> true

var equal = compareFactory('<', 'foo');
equal({ foo: 'foo' }, { foo: 'foo' }); //=> true
equal({ foo: 'foo' }, { foo: 'fon' }); //=> true
equal({ foo: 1337 }, { bar: 42 }); //=> false
```


## Operators

| =         | <       | >       | <=       | >=       | !=       | %=            |
| --------- | ------- | ------- | -------- | -------- | -------- | ------------- |
| `a === b` | `a < b` | `a > b` | `a <= b` | `a >= b` | `a != b` | `a % b === 0` |


## License

MIT © [Nicolas Gryman](http://ngryman.sh)

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