create a mapped eventuate
var eventuate = require('eventuate'),
map = require('eventuate-map')
var pie = eventuate()
pie(function (p) {
console.log('%s served...', p.type)
})
var addTopping = map(pie, function (pie) {
switch (pie.type) {
case 'shoofly':
pie.topping = 'vanilla ice cream'
break
case 'pumpkin':
pie.topping = 'whipped cream'
break
case 'apple':
pie.topping = 'maple walnut syrup'
break
default:
pie.topping = 'a cherry'
}
return pie
})
addTopping(function (p) {
console.log('Love %s on my %s pie', p.topping, p.type)
})
pie.produce({type: 'apple' })
pie.produce({type: 'shoofly' })
pie.produce({type: 'pumpkin' })var eventuate = require('eventuate')
var map = require('eventuate-map')
var upstreamEventuate = eventuate()Returns a new eventuate which produces mapped event payloads from eventuate upstreamEventuate using mapFunc . mapFunc should have the signature function (data) { }, and return the mapped payload. This function receives all event data from upstreamEventuate.
If upstreamEventuate is an unmonitored eventuate, filteredEventuate will return an unmonitored eventuate.
Stop consuming events from upstreamEventuate (and thus stop producing events).
The function added as a consumer to the upstreamEventuate. Example:
var consumerIdx = upstreamEventuate.consumers.indexOf(mappedEventuate.upstreamConsumer)
assert(consumerIdx >= 0)With npm do:
npm install eventuate-map
npm test [--dot | --spec] [--phantom] [--grep=pattern]
Specifying --dot or --spec will change the output from the default TAP style.
Specifying --phantom will cause the tests to run in the headless phantom browser instead of node.
Specifying --grep will only run the test files that match the given pattern.
npm run browser-test
This will run the tests in all browsers (specified in .zuul.yml). Be sure to educate zuul first.
npm run coverage [--html]
This will output a textual coverage report. Including --html will also open
an HTML coverage report in the default browser.

