# sate

> Small utility for generator-based iteration stacking.

Latest version **1.0.2** (published 2016-04-05) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-04-05 |
| First published | 2016-04-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jamen Marzonie |
| Maintainers | jamen |

## Links

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

## Recent versions

- 1.0.2 (latest) — 2016-04-05
- 1.0.1 — 2016-04-05
- 1.0.0 — 2016-04-05

## README

# Sate
> Small utility for generator-based iteration stacking.

Sate allows you to iterate an array (or something linear) and stack (`yield`) items in a new location.
```javascript
const sate = require('sate');

const foo = [1, 2, 3];
const bar = sate(foo, function* (item) {
  yield* [item, -item];
});

console.log(bar);
// => [1, -1, 2, -2, 3, -3]
```

## Installation
```shell
$ npm install --save sate
```

## Usage
```javascript
import sate from 'sate';
// or
const sate = require('sate');
// ...

sate(arr, function* (item, iterator, self) {
  // ...
});
```

### `sate(arr, fn*)`
Perform an iteration, and yield items into an output stack.
 - `arr` (`Array`): Item to iterate.
 - `fn*` (`function*`, generator): Iteration and stacking operation.

Example:
```javascript
const input = ['foo', 'bar:baz:qux', 'oof:rab', 'zab'];
const output = sate(input, function* (item) {
  yield* item.split(':');
});

console.log(output);
// => ['foo', 'bar', 'baz', 'qux', 'oof', 'rab', 'zab']
```

## Credits
| ![jamen][avatar] |
|:---:|
| [Jamen Marzonie][github] |

  [avatar]: https://avatars.githubusercontent.com/u/6251703?v=3&s=125
  [github]: https://github.com/jamen

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