# pull-thenable

> Convert a pull-stream into a thenable

Latest version **1.0.0** (published 2018-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install pull-thenable
pnpm add pull-thenable
yarn add pull-thenable
bun add pull-thenable
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-06-03 |
| First published | 2018-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | staltz.com |
| Maintainers | staltz |
| Keywords | pull-stream, then, thenable, promise, async-await |

## Links

- npm: https://www.npmjs.com/package/pull-thenable
- Repository: https://github.com/staltz/pull-thenable
- Issues: https://github.com/staltz/pull-thenable/issues
- npm.io page: https://npm.io/package/pull-thenable

## Dependencies (1)

- [quicktask](https://npm.io/package/quicktask.md) ~1.0.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-06-03

## README

# pull-thenable

> Converts a pull-stream to an object with .then(), usable also with async-await

```bash
npm install --save pull-thenable
```

## Usage

As a chain of then's:

```js
const pull = require('pull-stream')
const thenable = require('pull-thenable')

const stream = pull.values(['a','b']);
const source = thenable(stream);

source.then(x => {
  console.log(x); // 'a'
  return source;
}).then(x => {
  console.log(x); // 'b'
  return source;
}).then(x => {
  // not called
}, err => {
  console.log(err); // true
})
```

With async-await:

```js
const pull = require('pull-stream')
const thenable = require('pull-thenable')

const stream = pull.values(['a','b']);
const source = thenable(stream);

async function main() {
  while (true) {
    try {
      const x = await thenable(readable);
      console.log(x); // 'a'
                      // 'b'
    } catch (errOrEnd) {
      console.log(errOrEnd); // true
      return;
    }
  }
}

main();
```

## License
[MIT](https://tldrlegal.com/license/mit-license)

---
_Source: https://npm.io/package/pull-thenable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
