Socket
Socket
Sign inDemoInstall

async-iterable-map

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    async-iterable-map

Transforms items of an async iterable concurrently


Version published
Maintainers
1
Install size
18.9 kB
Created

Readme

Source

async-iterable-map

Transforms items of an async iterable concurrently

npm Gitlab pipeline status Dependency Status devDependency Status

Like p-map but for AsyncIterables.

If you like this package, be sure to star its repo, and please consider donating.

Usage

import { map } from "async-iterable-map"

map(source, transform, options = {})

Generic type parameters:

  • T = unknown - type of input elements
  • U = unknown - type of output elements

Parameters:

  • source: AsyncIterable<T> | Iterable<T> - the iterable to transform
  • transform: (element: T) => Promise<U> | U - the transform / mapping function from the input to the output
  • options.concurrency: number - how many elements to transform concurrently. Must be a positive integer or Infinity. Default: Infinity

Returns:

  • AsyncIterableIterator<U> & PromiseLike<U[]>
    • Use the AsyncIterableIterator<U> interface to iterate through the remaining output elements one by one.
    • Use the PromiseLike<U[]> interface to get all of the remaining output elements.

Both interfaces return the output elements in order.

Transforms items of an async iterable concurrently.

Keywords

FAQs

Last updated on 31 Jul 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc