# seem

> Promises and Generators

Latest version **2.0.0** (published 2016-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install seem
pnpm add seem
yarn add seem
bun add seem
```

## 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 | 2.0.0 |
| Published | 2016-07-01 |
| First published | 2015-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Stéphane Alnet |
| Maintainers | shimaore |
| Keywords | promises, generators |

## Links

- npm: https://www.npmjs.com/package/seem
- Repository: https://github.com/shimaore/seem
- Issues: https://github.com/shimaore/seem/issues
- npm.io page: https://npm.io/package/seem

## 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

- 2.0.0 (latest) — 2016-07-01
- 1.2.0 — 2016-05-28
- 1.1.1 — 2016-01-07
- 1.1.0 — 2015-10-07
- 1.0.0 — 2015-07-15

## README

seem: Promises and Generators for async/await
=============================================

`seem` is a tiny module that gives you the power of ES7's `async/await` using ES6's `yield`.

This is [@ForbesLindesay](https://github.com/ForbesLindesay)'s `async` function from his [Control Flow Utopia](http://pag.forbeslindesay.co.uk/) presentation, with an extension to accept non-thenable.

```javascript
var seem = require('seem');

var g = seem(function*(n){
  var a = yield Promise.resolve(n+4);
  var b = yield Promise.resolve(a+5);
  return b+3;
});
```

The function will now return a Promise that will resolve to the value of the `return` statement upon success.

```javascript
g(2).then(function(result){ assert(result === 2+4+5+3); })
```

Essentially, inside a `seem`-ified generator function, `yield` turns its Promise argument into that Promise's result.

Replace `Promise.resolve` in the example with your preferred asynchronous operation for full power.

Accepts non-Promises
--------------------

If the value you `yield` is not thenable, `seem` will turn it into a Promise.

```javascript
var seem = require('seem');

var g = seem(function*(n){
  var a = yield n+4;
  var b = yield Promise.resolve(a+5);
  return b+3;
});
```

In other words you can freely mix-and-match Promises and non-Promises, and `seem` will do the right thing.

(Contrarily to `co` v4, `seem` will not attempt to resolve Promises in an array or an object given to `yield`. It will pass the array or object as-is.)

This module uses native Promises by default; `seem.use(Promise)` to provide your own (or use a polyfill before including the module).

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