Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rxjs-from-iterable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-from-iterable

rxjs helper functions for working with Map, Set, Generator, and other Iterables.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by134.58%
Maintainers
1
Weekly downloads
 
Created
Source

rxjs-from-iterable

This is a simple Typescript library to help with converting iterables like Sets, Maps, and Generators into Rx.Observables.

This is a stop-gap library until Typescript 2.2, which extends support for Iterable to ES3 and ES5.

Installation

npm install --save rxjs-from-iterable rxjs

Usage

This library exposes three functions:

  • observableFromIterable: this is for working with generator functions or any other Iterable
  • observableFromSet: this is for working with Sets
  • observableFromMap: this is for working with Maps.

Examples

Sets

import * as Rx from 'rxjs/Rx';
import {observableFromSet} from 'rxjs-from-iterable';

export function uniqueWords(text: string): Rx.Observable<string> {
    const setUniqueWords = new Set(text.split(' '));
    return observableFromSet(setUniqueWords);
}

Generators

function* genFib() {
    let [a, b] = [0, 1];
    while (true) {
        [a, b] = [b, a + b];
        yield a;
    }
}

function fibonacci(): Rx.Observable<number> {
    return observableFromIterable(genFib());
}

Keywords

FAQs

Package last updated on 30 Jan 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc