Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sindresorhus/observable-to-promise

Convert an Observable to a Promise
https://github.com/sindresorhus/observable-to-promise

Last synced: 2 months ago
JSON representation

Convert an Observable to a Promise

Awesome Lists containing this project

README

        

# observable-to-promise

> Convert an [Observable](https://github.com/tc39/proposal-observable) to a Promise

## Install

```sh
npm install observable-to-promise
```

## Usage

```js
import observableToPromise from 'observable-to-promise';

const promise = observableToPromise(Observable.of(1, 2));

console.log(await promise);
//=> [1, 2]
```

## Related

- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable