Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antenna

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antenna - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

lib/application.js

2

lib/index.js
/**
* Module dependencies.
*/
var proto = require('./listener')
var proto = require('./application')
, utils = require('./utils');

@@ -6,0 +6,0 @@

@@ -22,2 +22,10 @@ /**

/**
* Check if this route matches `topic`, if so populate `params`.
*
* @param {String} topic
* @param {Array} params
* @return {Boolean}
* @api protected
*/
Route.prototype.match = function(topic, params) {

@@ -24,0 +32,0 @@ params = params || [];

@@ -25,2 +25,10 @@ /**

/**
* Route `topic` to one or more callbacks.
*
* @param {String} path
* @param {Function|Array} fns
* @return {Router}
* @api protected
*/
Router.prototype.route = function(topic, fns) {

@@ -52,2 +60,9 @@ var fns = utils.flatten([].slice.call(arguments, 1));

/**
* Route dispatcher, aka the router "middleware".
*
* @param {Message} msg
* @param {Function} next
* @api private
*/
Router.prototype._dispatch = function(msg, next) {

@@ -80,3 +95,4 @@ debug('dispatching %s (%s)', msg.topic, msg.originalTopic);

} else if (fn) {
fn(msg, callbacks);
if (fn.length < 3) { return fn(msg, callbacks); }
callbacks();
} else {

@@ -93,2 +109,12 @@ nextRoute(err);

/**
* Attempt to match a route for `msg`
* with optional starting index of `i`
* defaulting to 0.
*
* @param {Message} msg
* @param {Number} i
* @return {Route}
* @api private
*/
Router.prototype._match = function(msg, i) {

@@ -95,0 +121,0 @@ var topic = msg.topic

{
"name": "antenna",
"version": "0.0.1",
"version": "0.1.0",
"description": "Ubiquitous message bus for Node.js.",
"keywords": [
"bus",
"pubsub"

@@ -28,2 +29,7 @@ ],

"dependencies": {
"configurable": "0.0.x",
"urlpattern": "0.1.x",
"utils-merge": "1.x.x",
"utils-flatten": "1.x.x",
"debug": "0.7.x"
},

@@ -30,0 +36,0 @@ "devDependencies": {

# antenna
[![Build](https://travis-ci.org/jaredhanson/antenna.png)](https://travis-ci.org/jaredhanson/antenna)
[![Coverage](https://coveralls.io/repos/jaredhanson/antenna/badge.png)](https://coveralls.io/r/jaredhanson/antenna)
[![Quality](https://codeclimate.com/github/jaredhanson/antenna.png)](https://codeclimate.com/github/jaredhanson/antenna)
[![Dependencies](https://david-dm.org/jaredhanson/antenna.png)](https://david-dm.org/jaredhanson/antenna)
[![Tips](http://img.shields.io/gittip/jaredhanson.png)](https://www.gittip.com/jaredhanson/)
Antenna is a [publish/subscribe](http://en.wikipedia.org/wiki/Publish/subscribe)
middleware layer for [Node](http://nodejs.org). Applications can be constructed
by using _middleware_ and defining _routes_.
This architecture has been proven effective by [Express](http://expressjs.com/),
which provides HTTP middleware. Antenna adopts this approach, repurposing it
for use with a message bus, allowing listeners to be built quickly and easily,
using patterns familiar to Node.js developers.
## Install
$ npm install antenna
## Usage
var antenna = require('antenna');
var app = antenna();
app.listen('events/:event', function(msg, next) {
console.log('got event: ' + msg.params.event);
});
## Adapters
Adapters are used to connect to message buses, receiving messages and
dispatching those messages to the application for processing.
The following table lists commonly used adapters:
|Adapter |Developer |
|----------------------------------------------------|------------------------------------------------|
|[AMQP](https://github.com/jaredhanson/antenna-amqp) |[Jared Hanson](https://github.com/jaredhanson) |
## Tests
$ npm install
$ make test
## Credits
- [Jared Hanson](http://github.com/jaredhanson)
## License
[The MIT License](http://opensource.org/licenses/MIT)
Copyright (c) 2014 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc