whenable
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

whenable NPM Version travis

A minimal implementation of an object that supports streams of data.

Whenable is similar to:

  • RsJS Observables, except whenable is bare-bones.
  • Promises, except whenable can emit values many times before completing.

Example

import { Whenable } from 'whenable';
 
const whenable = new Whenable<number>((value, error, complete) => {
    value(1);
    value(2);
    complete();
}).when(value => {
    return (-2 * value).toString();
}).when(value => {
    console.log(value)
});

Package Sidebar

Install

npm i whenable

Weekly Downloads

0

Version

0.1.2

License

ISC

Last publish

Collaborators

  • nicksnyder