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 🙏

© 2024 – Pkg Stats / Ryan Hefner

synopsis

v0.10.0

Published

Efficiently computes synopsis of delta series.

Downloads

30

Readme

#synposis

build status

Synopsis is a tool computing the effective deltas between two updates in a sequence of updates.

The approach I'm taking is to take a granularity N, and then precompute skip deltas of size N, N2, N3, etc.

###Simple Counting Example:

// Uber simple Synopsis example that just calculates a running
// total of a sum of integers with granularity of 5
var async = require('async');
var _ = require('lodash');

var s = new Synopsis({
  start: 0,
  granularity: 5,
  patcher: function(prev, patch) {
    return prev + patch;
  },
  differ: function(before, after) {
    return after - before;
  }
});

async.eachSeries(_.range(1, 1001), function(n, cb) {
  s.patch(1, cb);
}, function(err) {
  s.sum(function(err, s) {
    console.log(s); // Outputs 1000
  });

  s.sum(500, function(err, s) {
    console.log(s);  // Outputs 500
  });

  s.delta(0, 10, function(err, d) {
    console.log(d); // Outputs 10
  });

  s.delta(5, 7, function(err, d) {
    console.log(d); // Outputs 2  
  });
});

Configuration

Supports specifying a custom store implementation, defaults to memory store if none is provided.

By doing so, the state of the Synopsis instance can be retained across restarts and none of the delta merging will need to be recomputed.

example:

var s = new Synopsis({
  store: {
    // get the value of the key in the store, or undefined if it isn't
    get: function(key, callback) { ... },
    
    // associate the value to the key in the store, undefined value is effectively a delete operation
    put: function(key, value, callback) { ... },

    // optionally define the following if the store provider has a batch operation for them.
    // getAll: function(keys, callback) { ... batch get hash ... }
    // putAll: function(obj, callback) { ... like setAll, but undefined values are deleted ... }
  }
});