evented-report

0.0.2 • Public • Published

Evented Report

NPM version

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

MIT

Module scaffold generated by generator-goodeggs-npm.

/evented-report/

    Package Sidebar

    Install

    npm i evented-report

    Weekly Downloads

    1

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • sherrman