https://github.com/sindresorhus/observable-to-promise
Convert an Observable to a Promise
https://github.com/sindresorhus/observable-to-promise
Last synced: 11 days 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 (over 9 years ago)
- Default Branch: main
- Last Pushed: 2023-11-01T09:48:57.000Z (over 1 year ago)
- Last Synced: 2025-04-15T08:32:53.198Z (20 days ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 47
- Watchers: 6
- 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)
- fucking-awesome-nodejs - observable-to-promise - Convert an Observable to a Promise. (Packages / Control flow)
- fucking-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