Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/sindresorhus/observable-to-promise
- Owner: sindresorhus
- License: mit
- Created: 2015-11-19T13:46:11.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2023-11-01T09:48:57.000Z (about 1 year ago)
- Last Synced: 2024-04-13T19:53:35.621Z (8 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 46
- Watchers: 7
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- awesome-nodejs-cn - observable-to-promise - **star:47** 将可观察到的转化为承诺 (包 / 控制流)
- awesome-nodejs - observable-to-promise - Convert an Observable to a Promise. (Packages / Control flow)
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