Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/segment-boneyard/wildcards

Wildcard event emitter matching for nodejs
https://github.com/segment-boneyard/wildcards

Last synced: about 5 hours ago
JSON representation

Wildcard event emitter matching for nodejs

Awesome Lists containing this project

README

        

# wildcards

Wildcard event-emitter proxy for nodejs.

## Installation

```
$ npm install wildcards
$ component install segmentio/wildcards
```

## Example

```js
var Emitter = require('events').EventEmitter;
var events = require('wildcards');

var app = new Emitter;

events(app, 'user:*', function(event, user){
console.log(' %s %s', event, user);
});

app.emit('foo');
app.emit('bar');
app.emit('user:logout', 'tobi');
app.emit('user:login', 'loki');
app.emit('user:login', 'jane');
```

Yielding:

```
user:logout tobi
user:login loki
user:login jane
```

# License

MIT