evented-report
v0.0.2
Published
[![NPM version](https://badge.fury.io/js/evented-report.png)](http://badge.fury.io/js/evented-report)
Downloads
2
Readme
Evented Report
Simple wrapper to node-csv for using events to pump data through the csv pipes.
Example
Sometimes you need to do several separate queries and compose them to to form your output. Here's simple, but common use case:
class JellyBeanInventory extends require 'evented-report'
# Set column headers to make emitting data clear & explicit. It also creates a csv header row.
columns: ['Flavor', 'My Tasting Notes', 'Quantity']
run: ->
JellyBean.find (err, jellies) ->
for jelly in jellies
@emit 'data',
Flavor: jelly.name
'My Tasting Notes': note.notes
Quantity: jelly.quantity
@emit 'end'
jbi = new JellyBeanInventory()
jbi.toCSV(process.stdout) # Give it an output stream!
Contributing
$ git clone https://github.com/goodeggs/evented-report && cd evented-report
$ npm install
$ npm test
Code of Conduct
Code of Conduct for contributing to or participating in this project.
License
Module scaffold generated by generator-goodeggs-npm.