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

jam

v0.6.1

Published

JAM your async calls together *faster*

Downloads

945

Readme

JAM

JAM it together like this:

jam(function() { doYourThing(); this(); })
  (function() { doOtherThingWithCallback(this); })
  (function() { doOtherThingWithCallbackArgs(this); })
  (function(result) { doNodeJsStuff(this); })
  (function(err, result) { setTimeout(this, 3000); })
  (function() { /* yay! we're done! */ });

That is, the this object is the next function to be called. Use this when you would normally pass a callback.

You can even nest JAMs inside each other:

jam(function() { jam(function() { jam(function() { ....

And the JAM chain would still execute correctly :)

And oh, you know what? You can even pass JAMs around! Try the test-passing.js example to see what I mean :)

WHY ?

Short answer: Because none of the existing ones are simple enough for my taste.

Yeah, I know there're tons of other continuation helpers out there already but there really isn't one where you could quickly just type-in the list of stuff to do and be done with it without worrying about forgetting to close the list with a parenthesis or forgetting to add a comma. And yeah, IMO it is wayyy easier to just add a (function() { }) block at the end because that's what you're usually doing all the time anyway taking care of all those JS variable scopes. And it is easier to copy/paste/reorder as well.

Another thing is that, most of them isn't very monadic. Yes, you can chain them. But then you can't pass those chains around or dynamically modify them except maybe using a few arguments trick/utils to help you. That has limited my ability to program and think somewhat especially since you should be thinking a lot about asynchronous-ness and continuations when working on node.js (that's the whole point of the platform, ain't it?)

So I decided, WTH, I could just write one.

And you gotta admit, writing all these stuff is just god damned fun! XD