rxjs-from-iterable

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

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
Last updated 8 years ago by jason-dent .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install rxjs-from-iterable 
SYNC missed versions from official npm registry.

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());
}

Current Tags

  • 1.0.5                                ...           latest (8 years ago)

6 Versions

  • 1.0.5 [deprecated]           ...           8 years ago
  • 1.0.4 [deprecated]           ...           8 years ago
  • 1.0.3 [deprecated]           ...           8 years ago
  • 1.0.2 [deprecated]           ...           8 years ago
  • 1.0.1 [deprecated]           ...           8 years ago
  • 1.0.0 [deprecated]           ...           8 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)

© 2010 - cnpmjs.org x YWFE | Home | YWFE