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 🙏

© 2025 – Pkg Stats / Ryan Hefner

awaitium

v1.0.2

Published

Put your await on fire and chain together async functions, promises and syncronous code in one line.

Readme

Awaitium - chain multiple awaits into one

Put your await on fire and make your code flow without intermediate awaits! Chain asynchrounous (and synchronous) functions together easily.

The best thing: Get full type support along the way. No fighting with the Typescript compiler. It's tamed!

Example

Write...

async function testChainedAwait()
{
    ....
    chainResult = await ing(asyncGetObject()).asyncGetAnotherObject().objectProperty.asyncInstanceGetter().synchronousFunction();
    ....
}

...instead of...

async function helpIAmRunningOutOfVariableNames()
{
    ....
    const initialObject = await asyncGetObject();
    const intermediateObject = await initialObject.asyncGetAnotherObject();
    const wantedInstance = await intermediateObject.objectProperty.asyncInstanceGetter();

    chainResult=wantedInstance.synchronousFunction();
    ....
}

Installation

Deno

In deno...

include { ing } from https://deno.land/x/awaitium@VERSION/source/awaitium.ts

Browser & Node

Both these environments are untested. Raise an issue if you come across any problems.

If you use npm do...

npm i awaitium

then in your sources...

include { ing } from "awaitium"

Usage

To use Awaitium, simply wrap the entry point of your chain with the ing(<yourEntryPoint>) function. An entry point can be one of the following:

  • a function call to a synchronous function:
await ing(syncFunction()).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember
  • a function call to an asynchronous function:
await ing(asyncFunction()).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember
  • any object:
await ing(object).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember

The chain following the ing call may comprise any combination of the following:

  • async function calls
  • synchronous function calls
  • property reads
  • member reads

Good to know

You must start your call chain (the start of the chain is the closing bracket of the ing function call) after the first call to an async function - but you can start your chain already at the very beginning:

await ing(object.member.asyncFunction()).syncFunction().doSomethingElseAsync()

... is the same as ...

await ing(object).member.asyncFunction().syncFunction().doSomethingElseAsync()

I like it clean: Personally I prefer wrapping objects (or function calls) the earliest possible.

Caveats

Behind the scenes every function call is awaited. As you can also chain synchronous function calls, that means these synchronous calls may also be waiting for their turn of the event loop (depending on the JS engine/environment, I guess?!). This is uninvestigated, however - if you'd like to add more insight into this, feel free to raise an issue. In most applications this should have negligable impact, though.

License

MIT