<commit_before># js-match

[![NPM][npm]](https://npmjs.org/package/js-match)
[![Dependency Status][dependencies]](https://david-dm.org/TabDigital/js-match)
[![Build Status][travis]](http://travis-ci.org/TabDigital/js-match)


[![NPM](https://nodei.co/npm/js-match.png)](https://nodei.co/npm/js-match/)

Validates an entire Javascript object against a set of nested matchers.
This can be useful to quickly validate:

- a JSON config file
- the structure of an HTTP request payload

*Note:* `js-match` will always ignore extra fields, as long as the set of matchers passes. This conforms with the robustness principle of "be conservative in what you do, be liberal in what you accept".

## Basic usage

```coffee
jsm = require 'js-match'

person =
  name: { match: 'string' }
  age:  { match: 'number' }

# success
errors = jsm.validate {name: 'Bob', age: 30}, person
errors.should.eql []<commit_msg>Revert README badges<commit_after># js-match

[![NPM](https://nodei.co/npm/js-match.png)](https://nodei.co/npm/js-match/)

Validates an entire Javascript object against a set of nested matchers.
This can be useful to quickly validate:

- a JSON config file
- the structure of an HTTP request payload

*Note:* `js-match` will always ignore extra fields, as long as the set of matchers passes. This conforms with the robustness principle of "be conservative in what you do, be liberal in what you accept".

## Basic usage

```coffee
jsm = require 'js-match'

person =
  name: { match: 'string' }
  age:  { match: 'number' }

# success
errors = jsm.validate {name: 'Bob', age: 30}, person
errors.should.eql []
{'fraction_non_alphanumeric': 0.13466334164588528, 'fraction_numerical': 0.0024937655860349127, 'mean_word_length': 4.279605263157895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1606070', 'n_tokens_mistral': 537, 'n_tokens_neox': 509, 'n_words': 183}