# mrspider-validator

> mrspider middleware to validate data that has been extracted.

Latest version **1.1.0** (published 2016-03-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install mrspider-validator
pnpm add mrspider-validator
yarn add mrspider-validator
bun add mrspider-validator
```

## 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.1.0 |
| Published | 2016-03-28 |
| First published | 2015-12-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sean Hayes |
| Maintainers | vermiculite |
| Keywords | mrspider, middleware, validator, data |

## Links

- npm: https://www.npmjs.com/package/mrspider-validator
- Repository: https://github.com/vermiculite/mrspider-validator
- Homepage: https://github.com/vermiculite/mrspider-validator#readme
- Issues: https://github.com/vermiculite/mrspider-validator/issues
- npm.io page: https://npm.io/package/mrspider-validator

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^2.0.1
- [validate](https://npm.io/package/validate.md) ^3.0.1

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-03-28
- 1.0.2 (beta) — 2016-03-01
- 1.0.1 — 2016-03-01
- 1.0.0 — 2016-02-29
- 0.0.1 — 2015-12-23

## README

# mrspider-validator

middleware for [mrspider](https://github.com/vermiculite/mrspider) typically used after data extraction middlware such as [regex data extractor](https://github.com/vermiculite/mrspider-regex-data-extractor), [css image extraction](https://github.com/vermiculite/mrspider-css-image-extraction) and [css data extractor](https://github.com/vermiculite/mrspider-css-data-extractor) before any persistence middleware such as [mongodb persister](https://github.com/vermiculite/mrspider-mongodb-persister).

Its purpose is to clean up extracted data removing any fields not included in the validation and converting types to those specified in the validation. Also marks the `page.valid` property true or false to avoid persisting invalid data.

## Install

`npm i -S mrspider-validator`

## Usage

```js
var spider = require('mrspider');
var mrspiderValidator = require('mrspider-validator');
var validRules = {
            name: {
                type: 'string',
                required: true,
                message: 'name is required'
            },
            age: {
                type: 'number',
                required: true,
                message: 'supposed to be a number'
            }
        };
spider.use(mrspidervalidator(validRules));

```

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