evented-report
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "evented-report", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Good Eggs <open-source@goodeggs.com>", |
@@ -5,8 +5,30 @@ # Evented Report | ||
[![Build Status](https://travis-ci.org/goodeggs/evented-report.png)](https://travis-ci.org/goodeggs/evented-report) | ||
Simple wrapper to [node-csv](https://www.npmjs.org/package/csv) for using events to pump data through the csv pipes. | ||
## Example | ||
Simple wrapper to [node-csv](https://www.npmjs.org/package/csv) for using events to pump data through the csv pipes. | ||
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 | ||
@@ -13,0 +35,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9770
52