category-count-stream

1.0.0 • Public • Published

category-count-stream

Count occurances of nominal categories in a JSON object streams of a given key.

Install with npm install category-count-stream.

Example

var categorycount = require('category-count-stream')
 
var countFood = categorycount('food', function (result) {
  console.log(result) // outputs { banana: 1, tofu: 2, missing: 1 }
})
 
countFood.write({food: 'banana'})
countFood.write({food: 'tofu'})
countFood.write({food: 'tofu'})
countFood.write({bla: 'blub'})
countFood.end()

CLI

If you install it with npm install category-count-stream -g, there will be the category-count tool available.

Given a file food.ldjson

{"food": "tofu"}
{"food": "tofu"}
{"food": "tofu"}
{"food": "banana"}
{"bla": "blub"}

This command will return the following:

$ category-count food < food.ldjson
{"tofu":3,"banana":1,"missing":1}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i category-count-stream

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • finnpauls