Socket
Socket
Sign inDemoInstall

rxjs-async-map

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rxjs-async-map

Map an observable using an async function with a configurable concurreny level, while preserving element order.


Version published
Maintainers
1
Install size
41.1 kB
Created

Readme

Source

rxjs-async-map

Map an observable using an async function with a configurable concurreny level, while preserving element order.

CircleCI Greenkeeper badge

Installation

rxjs-async-map is available via npm or yarn:

npm i --save rxjs-async-map
yarn add rxjs-async-map

Usage

import { of } from 'rxjs/observable/of';
import { asyncMap } from 'rxjs-async-map';

const myPromise = val =>
  new Promise(resolve => setTimeout(() => resolve(`Result: ${val}`), Math.random() * 1000));

const source = of(1, 2, 3);

// Map over the observable using the async function, while running
// up to two promises concurrently.
//
// The order of elements is preserved, even if the promises resolve
// out-of-order.
const example = source.pipe(asyncMap(myPromise, /* concurrency: */ 2));

/*
  output:
  "Result: 1"
  "Result: 2"
  "Result: 3"
*/
const subscribe = example.subscribe(val => console.log(val));

License

MIT

FAQs

Last updated on 11 Oct 2021

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