p-map-series

WebJar for p-map-series

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

p-map-series
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

p-map-series
WebJar for p-map-series
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/p-map-series

Скачать p-map-series

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/p-map-series/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>p-map-series</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/p-map-series/
implementation 'org.webjars.npm:p-map-series:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/p-map-series/
implementation ("org.webjars.npm:p-map-series:1.0.0")
'org.webjars.npm:p-map-series:jar:1.0.0'
<dependency org="org.webjars.npm" name="p-map-series" rev="1.0.0">
  <artifact name="p-map-series" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='p-map-series', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "p-map-series" % "1.0.0"
[org.webjars.npm/p-map-series "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : p-reduce jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

p-map-series

Map over promises serially

Useful as a side-effect mapper. Use p-map if you don't need side-effects, as it's concurrent.

Install

$ npm install p-map-series

Usage

import pMapSeries from 'p-map-series';

const keywords = [
	getTopKeyword() //=> Promise
	'rainbow',
	'pony'
];

let scores = [];

const mapper = async keyword => {
	const score = await fetchScore(keyword);
	scores.push(score);
	return {keyword, score};
});

console.log(await pMapSeries(keywords, mapper));
/*
[
	{
		keyword: 'unicorn',
		score: 99
	},
	{
		keyword: 'rainbow',
		score: 70
	},
	{
		keyword: 'pony',
		score: 79
	}
]
*/

API

pMapSeries(input, mapper)

Returns a Promise that is fulfilled when all promises in input and ones returned from mapper are fulfilled, or rejects if any of the promises reject. The fulfilled value is an Array of the mapper created promises fulfillment values.

input

Type: Iterable<Promise | unknown>

Mapped over serially in the mapper function.

mapper(element, index)

Type: Function

Expected to return a value. If it's a Promise, it's awaited before continuing with the next iteration.

Related

  • p-each-series - Iterate over promises serially
  • p-reduce - Reduce a list of values using promises into a promise for a value
  • p-map - Map over promises concurrently
  • More…

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Версии библиотеки

Версия
1.0.0