object-router

0.1.0 • Public • Published

object-router  Build Status

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

npm i object-router

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • matteo.collina