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

heya-async

v1.0.1

Published

Asynchronous utilities: promises, deferreds.

Downloads

70

Readme

Async

Build status Dependencies devDependencies NPM version

Promises and operations over them; useful utility functions.

What is inside?

Practical algorithms for node.js and browsers operating on any Promises (any then()-able will do, including ES6's Promise):

  • Aggregate all asynchronous operations:
    • all() — similar to standard Promise.all(). Returns an array of results, or fails with a first failed promise.
    • par() — collects all results into an array, both normal values, and errors. Never fails.
      • Use case: collect all I/O results regardless if they failed or not.
      • Use case: wait for all asynchronous operations to finish regardless of their outcome.
  • Race asynchronous operations determing a winner:
    • race() AKA one() — similar to standard Promise.race(). Resolves or fails with the first fulfilled promise.
    • any() — resolves with a first resolved promise. Failed promises are ignored unless all of them have failed. In the latter case it fails with the value of the first one in the array.
      • Use case: use the first successful I/O request, ignore services that failed.
  • Orchestrate asynchronous functions:
    • seq() — a helper to run asynchronous operations sequentially one after another.
      • Use case: run operations, which depend on previous asynchronous results.
    • whilst() — a generalized asynchronous loop.
  • Adapters:
    • when() — adapt any value (then()-able, or a plain value) to a promise.
    • promisify() — adapt node.js asynchronous callback-style functions to promise-based functions.
  • Timeouts:
    • timeout() — resolve or reject a value after a timeout. If combine with other composition operations, like race(), it can help to implement any time-dependent conditions, e.g., timeouts on operations.
  • Specialized deferreds/promises:
    • Deferred — fast deferred implementation without built-in timeouts unlike A+ Promises. Implements progress reports, and cancellations. Very helpful for debugging because it preserves call stacks.
    • FastDeferred — just like Deferred but even faster, because it doesn't convert exceptions into failed promises implicitly. It allows to JIT all of its code, and helps to debug unexpected exceptions.

How to install

With npm:

npm install --save heya-async

With bower:

bower install --save heya-async

Documentation

All documentation can be found in project's wiki.

To get more information on underlying concepts:

Included algorithms (work across all type of promises):

Included implementations of deferreds (can be used instead or alongside with the standard Promise):

License

BSD or AFL — your choice

Versions

  • 1.0.1 — Removed a direct dependence on heya-ice in Micro.
  • 1.0.0 — Starts the new generation.

For information on all pre-1.0.0 versions, please see the commit log.