Nostalgic Perogi Monogramming
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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

install

npm i object-router

Downloadsweekly downloads

4

version

0.1.0

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar