Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

category-count-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

category-count-stream

Writable object stream for getting percentages of categories

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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}

Keywords

FAQs

Package last updated on 02 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc