2.0.0 • Published 7 months ago

pmap-lit v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

pmap-lit

This package is a helper to run promise-returning and async functions multiple times with different inputs concurrently.

It let's you control concurrency as well as decide wether or not to stop iteration on errors.

Requirements

  • Node v12+

Installation

$ npm i pmap-lit
# or
$ yarn add pmap-lit

Usage

import { pMap } from 'pmap-lit';

const iterable = [
	Promise.resolve('https://cloud.google.com/'),
	'https://aws.amazon.com/',
	'https://azure.microsoft.com/',
];

const results = await pMap(
	iterable,
	async (site) => {
		const { url } = await fetch(site);
		return url;
	},
	{ concurrency: 2 }
);

console.log(result);
// ➞ ['https://cloud.google.com/', 'https://aws.amazon.com/', 'https://azure.microsoft.com/']

API

Development

(1) Install dependencies

$ npm i
# or
$ yarn

(2) Run initial validation

$ ./Taskfile.sh validate

(3) Start developing. See ./Taskfile.sh for more tasks to help you develop.


This project was set up by @jvdx/core

2.0.0

7 months ago

1.2.1

1 year ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago