# matrix-eventfilter

> Pass/Fail Object based filter. For Matrix OS

Latest version **1.0.0** (published 2016-09-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install matrix-eventfilter
pnpm add matrix-eventfilter
yarn add matrix-eventfilter
bun add matrix-eventfilter
```

## 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.0 |
| Published | 2016-09-21 |
| First published | 2016-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| Author | Sean Canton |
| Maintainers | matrix-io |
| Keywords | admobilize |

## Links

- npm: https://www.npmjs.com/package/matrix-eventfilter
- Repository: https://github.com/matrix-os/matrix-eventfilter
- Homepage: https://github.com/matrix-os/matrix-eventfilter#readme
- Issues: https://github.com/matrix-os/matrix-eventfilter/issues
- npm.io page: https://npm.io/package/matrix-eventfilter

## Dependencies (5)

- [mocha](https://npm.io/package/mocha.md) ^2.2.5
- [lodash](https://npm.io/package/lodash.md) ^3.9.3
- [should](https://npm.io/package/should.md) ^6.0.3
- [request](https://npm.io/package/request.md) ^2.58.0
- [geo-distance](https://npm.io/package/geo-distance.md) ^0.1.2

## Recent versions

- 1.0.0 (latest) — 2016-09-21

## README

# Instance Methods for Streaming API on Device & Server

**Initialize With**

```
var EventFilter = require('matrix-eventfilter').EventFilter;
var face = new EventFilter('face');
var vehicle = new EventFilter('vehicle');
```

## Example Usage

### Requires Then to Activate
```
// starts stream and queues callback
face.then(function(results, filter){})
```

### Basic Filters
#### is / like
```
// single declaration
face.is('age', 23)

// object declaration
face.is({ 'age' : 24, gender:'male' })

// ranges
face.is({'age': {'$lte': 24, '$gte': 18}})
```

#### not

Negation

`face.not('device')`

#### contains

String match

`vehicle.contains('make', 'Mustang')`

#### near

Point and range.

`vehicle.near([25,80], 1)`

### Complex Filters
#### Has
Has enables a subset of filters

##### Between
```
face.has('age').between(18,25);
```

##### Within
```
face.has('device').within([12,13,14,16]);
```

##### After (Aliases: Over, Above)
```
vehicle.has('year').after(1960);
```

##### Before (Aliases: Under, Below)
```
vehicle.has('year').under(2000)
```

##### Of
```
vehicle.has('color').of('red')
```

### Real-World Examples
Vehicles traveling at high speeds.
```
vehicle.has('year').before(1960).has('speed').above(70).then(function(response) {
  console.log('Car is unsafe to drive at these speeds.');
});
```

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