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

csp-ksh

v1.0.1

Published

Playing with CSP without generators

Downloads

5

Readme

csp-ksh

Experiments in CSP after reading:

  • http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-in-JavaScript
  • http://phuu.net/2014/08/31/csp-and-transducers.html

You probably shouldn't use this. Although there are tests, I don't fully understand CSP / transducers yet!

Then I also read:

  • http://simplectic.com/blog/2014/transducers-explained-1/
  • http://jlongster.com/Transducers.js--A-JavaScript-Library-for-Transformation-of-Data

Supports:

  • transducers
  • buffer strategies: Sliding, Dropping, Fixed

Does not require generators!

Examples

See test.js. Otherwise here's an example of finding the mouse vector:

view on requirebin

var td = require('transducers-js');
var csp = require('./');
var chan = csp.chan;
var put = csp.put;
var take = csp.take;

// Create a channel with a buffer of size 2 using a sliding window strategy,
// with a transducer that groups as tuples.
var ch = chan([csp.SLIDING, 2], td.partitionAll(2));

// Built without generators, so we need our own "event loop".
(function next() {
  take(ch, function(ps) {
    var p1 = ps[0];
    var p2 = ps[1];
    if (p1 === chan.CLOSED || p2 === chan.CLOSED) return;
    document.body.innerHTML = ''
      + '<span style="font-size: 72px; text-align: center;">'
      + (p2.x - p1.x) + ', ' + (p2.y - p1.y)
      + '</span>'
    next();
  })
}())

// Always put the newest event into the channel.
document.body.addEventListener('mousemove', function(event) {
  put(ch, { x: event.clientX, y: event.clientY });
}, false)

Why?

Wanted to play around, also wanted to see how small (yet practical) I could make it, transducers and all. Generators are obviously possible via transpilation, but this provides a test bed for playing around in an environment without them.

License

MIT