Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

parzhitsky/observable-to-async-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

observable-to-async-generator

Convert an observable to ES6 async generator.

Import

TypeScript:

import otag from "observable-to-async-generator";

JavaScript:

const otag = require("observable-to-async-generator").default;

Usage

try {
	for await (const item of otag(observable))
		doSomethingWith(item);
}

catch (error) {
	handle(error);
}

Notes

  • rxjs@6 is a peer dependency for this package; it is primarily used to add types on the development stage. These type imports are removed from the JavaScript output, but are still present in *.d.ts files; in case if the type information is needed, rxjs@6 should be installed manually.