npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

suddenstats

v1.0.6

Published

Simple fast statistcs that stay updated on the fly. intended for high volume streaming data

Readme

suddenStats

minimal config common statistics

intended for high volume streaming data

a statsistics library will typically require a separate lop through an array of data to get each stat. sudenStats is written to reduce the loops through an array to be as fast as possible and get everything in 1 pass.

can use these stats to make very fast decisions in app logic, or display constantly changing values.

data can be fed to qData function as often as needed. it will buffer for specified batch time frames, and limit the batch in that timeframe to a defined limit.

the throttle time and buffer size are auto adjusting, but can be given values

##QuickStart:

for node: npm install suddenstats or browser: bower install suddenstats

##node include

var SuddenStats   = require("../SuddenStats");

##browser include

<script src="bower_components/suddenstats/utils.js"></script>
<script src="bower_components/suddenstats/SuddenStats.js"></script>

Simple mode addData, nothing fancy, pass in arrays of numbers and access stats

var objStats = new SuddenStats();
//add a batch of data
objStats.addData([1,2,3,4,5,6]); 
objStats.addData([15,16,17,18,19,]);
//display the results of a stat
console.log(objStats.stats.primary.diff);

Simple Mode qData, let things get batched automatically, becuase there is a lot of data

var objStats = new SuddenStats();
	//throw a bunch of data in, let it batch on its own
    for(var i=1;i<=1001;i++){ objStats.qData(i); }
   console.log(objStats.stats.primary.count);

Pass in an object and a config to exit simple mode and do more than number stats

//pass in a config for stats
var objStats = new SuddenStats({
      stats:
       {
         source:{type:"uniq",path:"source"}
        ,user:{type:"compete",path:"user",score:"score"}
        ,user_source:{type:"co-occurence",path:"user",path2:"source"}
        ,score:{type:"numeric",path:"score"}
      }
    });
//pass in objects, qdata can also be used
    objStats.addData(
      [
         {"source":"wikipedia","user":"anthony","score":11}
        ,{"source":"wikipedia","user":"randall","score":19}
        ,{"source":"twitter","user":"anthony","score":8}
        ,{"source":"wikipedia","user":"wes","score":33}
        ,{"source":"wikipedia","user":"anthony","score":78}
        ,{"source":"wikipedia","user":"wes","score":43}
        ,{"source":"twitter","user":"wes","score":56}
        ,{"source":"wikipedia","user":"randall","score":24}
      ]
    ); 
   console.log(objStats.stats.source.values.wikipedia);

Define with windows

//pass in a config for stats, keep 1 minute windows for and hour and hourly windows for 1 day, minute,hour,day :only define largets window, the others are assumed
var objStats = new SuddenStats({
      stats:
       {
        score:{type:"numeric",path:"score",windows:'day'}
      }
    });

##Options

  • stats: define the statistics required
  • windows: define the time windows that need to be kept, in seconds

###Statistics Types

  • numeric: pure numerical stats
  • uniq: unique value counts
  • compete: unique value + numerical stats
  • co-occurence: 2 value combination counts

###Windows

  • seconds: interval to keep stats within as snapshots
  • window count: how many windows to keep in history

references: http://simplestatistics.org/docs/