# gean

> Composable Generator Control

Latest version **0.0.6** (published 2015-12-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2015-12-08 |
| First published | 2015-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Joseph Werle |
| Maintainers | werle |
| Keywords | tiny, generator, control |

## Links

- npm: https://www.npmjs.com/package/gean
- Repository: https://github.com/littlstar/gean
- Homepage: https://github.com/littlstar/gean#readme
- Issues: https://github.com/littlstar/gean/issues
- npm.io page: https://npm.io/package/gean

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2015-12-08
- 0.0.5 — 2015-10-28
- 0.0.4 — 2015-10-28
- 0.0.3 — 2015-10-27
- 0.0.2 — 2015-10-26
- 0.0.1 — 2015-10-26

## README

gean
====

gean provides a mechanism for composable generator control with
promises.

## why ?

* tiny.
* zero dependencies.
* composable.
* `Promise` based.


## installation

```sh
$ npm install gean --save
```

## usage

```js
gean(function * () {
  // flow control here
});
```

`gean` accept a `GeneratorFunction` and returns a `Promise`
that allow for composability.

## example

We can use `gean` to create simple a `fetch` function backed by
[superagent](https://github.com/visionmedia/superagent). We'll use it to
read from the `randomuser` API and sum the number of `male` and `female`
gender entries per user.

```js
import agent from 'superagent';
import gean from 'gean';

const fetch = uri => new Promise((yep, nope) => {
  agent.get(uri).end((err, res) ? nope(err) : yep(res));
};

gean(function * () {
  const uri = 'https://randomuser.me/api?results=10';
  const res = yield fetch(uri);
  const users = res.body.results;
  const counter = {female: 0, male: 0};

  for (let user of users)
    counter[user.gender]++;

  console.log(counter)
  // { female: 8, male: 2 }
});
```

## license

MIT

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