object-router
0.1.0 • Public • Published 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
Package Sidebar
Install
Weekly Downloads