New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@comodinx/async-helpers

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comodinx/async-helpers

@comodinx/async-helpers is a module for optimize async usage.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Async helpers

INSPIRATE ON p-limit OF Sindre Sorhus

@comodinx/promise-helpers is a module for optimize promise usage.

Index

  • [Download & Install][install].
  • [How is it used?][how_is_it_used].
  • [Tests][tests].

Download & Install

NPM

$ npm i @comodinx/async-helpers

Source code

$ git clone https://gitlab.com/comodinx/async-helpers.git
$ cd async-helpers
$ npm i

How is it used?

Run multiple promise-returning & async functions with limited concurrency

asyncLimit

import { asyncLimit } from "@comodinx/async-helpers";

const limit = asyncLimit(1);

const input = [
	limit(() => fetchSomething('foo')),
	limit(() => fetchSomething('bar')),
	limit(() => doSomething())
];

// Only one promise is run at once
const result = await Promise.all(input);
console.log(result);

asyncLimitFn

import { asyncLimitFn } from "@comodinx/async-helpers";

const limitedFunction = asyncLimitFn(async () => {
	return doSomething();
}, {concurrency: 1});

const input = Array.from({length: 10}, limitedFunction);

// Only one promise is run at once.
await Promise.all(input);

Keywords

async

FAQs

Package last updated on 06 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts