# zan-compare

> Compare zan object to and JS object and validate

Latest version **1.0.1** (published 2016-04-01) · ISC license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2016-04-01 |
| First published | 2016-04-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | eisisig |

## Links

- npm: https://www.npmjs.com/package/zan-compare
- npm.io page: https://npm.io/package/zan-compare

## Dependencies (2)

- [zan](https://npm.io/package/zan.md) ^3.0.0
- [lodash.forown](https://npm.io/package/lodash.forown.md) ^4.0.2

## Recent versions

- 1.0.1 (latest) — 2016-04-01
- 1.0.0 — 2016-04-01

## README

# zan compare

I needed a small lib to compare a shape of an object to predefined validation object. We were planning on using zan for propTypes so with this we could use zan to compare 2 objects and validate.

See **zan** for more info [zan](https://github.com/kolodny/zan)

## Usage

### compare(shape, data [, returnErrors:bool])

```javascript
const zan = require('zan');
const compare = require('zan-compare');

const { recursive, types } = zan;
const { number, string } = types;

const shape = recursive({
	age: number,
	name: string,
	emails: [string]
});

const data = {
	age: 32,
	name: 'Eisi Sig',
	emails: false
};

const isValid = compare(shape, data);
// isValid = false, emails is expected to be an array
```

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