metamatch
v2.0.1
Published
pull stream to match against objects with metaprogramming
Downloads
3
Maintainers
Readme
metamatch
pull stream that uses metaprogramming to match arbitrary patterns in javascript objects
install
npm install metamatch
example
var pull = require('pull-stream');
var test = require('tape');
var meta_match = require('metamatch');
var meta = meta_match ();
meta.add('demo');
meta.add('split', 'demo');
test('should fire event emitters on successful match', function (t) {
t.plan(2);
meta.on('demo', function (data) {
t.ok(typeof data === 'object');
});
meta.on('split', function (data) {
t.ok(typeof data === 'object');
});
pull(
pull.values([ { demo: true } ]),
meta.match(),
pull.collect(function (err, result) {
console.log(result);
})
)
pull(
meta.tap('demo'), // same as using meta.on()
pull.log() // but as a pull stream
});