object-router
v0.1.0
Published
Route your functions with pattern matching
Downloads
2
Maintainers
Readme
object-router
Route your functions with pattern matching. Inspired by seneca.
object-router is based on bloomrun, so all patterns will be matched in insertion order.
Install
npm i object-router --save
Example
'use strict'
var router = require('object-router')()
router.add({
cmd: 'hello'
}, function (msg, cb) {
cb(null, {
result: 'hello ' + msg.name
})
})
router.act({
cmd: 'hello',
name: 'world'
}, console.log)
License
MIT