<commit_before># patrun

### A fast pattern matcher on JavaScript object properties. 

Need to pick out an object based on a subset of its properties? Say you've got:

```JavaScript
{ x:1,     } -> A
{ x:1, y:1 } -> B
{ x:1, y:2 } -> C
```

Then patrun can give you the following results:

```JavaScript
{ x:1 }      -> A
{ x:2 }      -> no match
{ x:1, y:1 } -> B
{ x:1, y:2 } -> C
{ x:2, y:2 } -> no match
{ y:1 }      -> no match
```

It's basically _query-by-example_ for property sets.

This module is used by the [Seneca](http://senecajs.org) framework to pattern match actions.



### Support

If you're using this library, feel free to contact me on twitter if you have any questions! :) [@rjrodger](http://twitter.com/rjrodger)

This module works on both Node.js and browsers.

Current Version: 0.4.1

Tested on: Node.js 0.10.31, Chrome 38, Firefox 33, Safari 7, Opera 25

[![Build Status](https://travis-ci.org/rjrodger/patrun.png?branch=master)](https://travis-ci.org/rjrodger/patrun)



### Quick example

Here's how you register some patterns, and then search for matches:

```JavaScript
var patrun = require('patrun')

var pm = patrun()
      .add({a:1},'A')
      .add({b:2},'B')

// prints A
console.log( pm.find({a:1}) ) 

// prints null
console.log( pm.find({a:2}) ) 

// prints A, b:1 is ignored, it was never registered
console.log( pm.find({a:1,b:1}) ) 

// prints B, c:3 is ignored, it was never registered
console.log( pm.find({b:2,c:3}) ) 
```

You're matching a subset, so your input can contain any number of other properties.


## Install

For Node.js:

```sh
npm install jsonic
```

For Bower:

```sh
bower install patrun
```
<commit_msg>Fix typo in installation instructions<commit_after># patrun

### A fast pattern matcher on JavaScript object properties. 

Need to pick out an object based on a subset of its properties? Say you've got:

```JavaScript
{ x:1,     } -> A
{ x:1, y:1 } -> B
{ x:1, y:2 } -> C
```

Then patrun can give you the following results:

```JavaScript
{ x:1 }      -> A
{ x:2 }      -> no match
{ x:1, y:1 } -> B
{ x:1, y:2 } -> C
{ x:2, y:2 } -> no match
{ y:1 }      -> no match
```

It's basically _query-by-example_ for property sets.

This module is used by the [Seneca](http://senecajs.org) framework to pattern match actions.



### Support

If you're using this library, feel free to contact me on twitter if you have any questions! :) [@rjrodger](http://twitter.com/rjrodger)

This module works on both Node.js and browsers.

Current Version: 0.4.1

Tested on: Node.js 0.10.31, Chrome 38, Firefox 33, Safari 7, Opera 25

[![Build Status](https://travis-ci.org/rjrodger/patrun.png?branch=master)](https://travis-ci.org/rjrodger/patrun)



### Quick example

Here's how you register some patterns, and then search for matches:

```JavaScript
var patrun = require('patrun')

var pm = patrun()
      .add({a:1},'A')
      .add({b:2},'B')

// prints A
console.log( pm.find({a:1}) ) 

// prints null
console.log( pm.find({a:2}) ) 

// prints A, b:1 is ignored, it was never registered
console.log( pm.find({a:1,b:1}) ) 

// prints B, c:3 is ignored, it was never registered
console.log( pm.find({b:2,c:3}) ) 
```

You're matching a subset, so your input can contain any number of other properties.


## Install

For Node.js:

```sh
npm install patrun
```

For Bower:

```sh
bower install patrun
```

{'fraction_non_alphanumeric': 0.15613825983313467, 'fraction_numerical': 0.023241954707985697, 'mean_word_length': 3.399737876802097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 4, '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': '6898610', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1185, 'n_words': 410}