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

@mighty-maker/async-operators

v0.1.4

Published

Async operators for composable async pipelines

Readme

Async Operators

This library contains a collection of utilities useful for composing pipelines of async functions. Many functions in this library have a synchronous analog such as Pipe, Map, and Reduce. These should be familiar and can be used like their synchronous counterparts.

Installation

npm i --save @mighty-maker/async-operators

Usage

asyncPipe

asyncPipe is the backbone of this library and is used to compose a list of async functions, making your program's flow easy to read and reason about. For example:

const addOneAsync = async (x) => new Promise((resolve) => setTimeout(() => resolve(x + 1), 500))
const addTwoAsync = async (x) => new Promise((resolve) => setTimeout(() => resolve(x + 2), 500))
const addThree = (x) => x + 3

const pipeline = asyncPipe(
 addOneAsync,
 addTwoAsync,
 addThree
)

await pipeline(1) // 4

Here, we are creating a new function pipeline that is the result of compose three other functions. addOneAsync is applied to the value passed to pipeline and addTwoAsync is applied to the result of addOneAsync. Notice the inclusion of addThree in the pipeline. Not every function in the pipeline needs to be async, you can perform synchronous operations at any stage.

asyncSeries

asyncSeries is a bit of an outlier in that it doesn't have a direct analog in JavaScript's built in array operators. Where it's useful is in running a series of async functions where you don't care about the individual results of the function calls, but simply that the series of functions ran. For convenience, asyncSeries will return the result of the final function call.

 const addTwoAsync = asyncSeries(async (x) => new Promise(resolve => setTimeout(() => resolve(x + 2), 500)))
 const finalResult = await addTwoAsync([1,2,3]) // 5

Here the result of calling addTwoAsync on the last value in the list (3) is returned (5) even though addTwoAsync as applied all the numbers in the list.

Example use case: firing off a series of messages to a service that will process them in the background. Here the return value of the function is irrelevant, we just care that the message was sent without an error.

asyncMap

asyncMap can be thought of as Array.map() but performed asynchronously. The results of applying the mapper function you provide to each element in the list are returned as a list.

const mapAddTwoAsync = asyncMap(async (x) => new Promise(resolve => setTimeout(() => resolve(x + 2), 500))) 
const resultsList = await mapAddTwoAsync([1,2,3]) // [3, 4, 5]

asyncReduce

asyncReduce can be thought of as Array.reduce() but performed asynchronously. The results of applying the reducer function to each element in the list are accumulated and returned as the final result.

const asyncDouble = async x => new Promise((resolve) => { setTimeout(() => resolve(x + x), 500) })
const asyncDoubleSum = asyncReduce(async (prev, val) => prev + await asyncDouble(val), 0)
 
const accumulatedRestul = await asyncDoubleSum([1,2,3]) // 12

asyncReduce can be useful for retrieving paginated restults from an API.