An open API service indexing awesome lists of open source software.

https://github.com/parro-it/iterate-fun

A function toolbelt to work with iterables
https://github.com/parro-it/iterate-fun

Last synced: 10 months ago
JSON representation

A function toolbelt to work with iterables

Awesome Lists containing this project

README

          

# iterate-fun

> A function toolbelt to work with iterables

background details relevant to understanding what this module does

## Usage

description of the example

```js
const iterateFun = require('iterate-fun');

console.log({iterateFun});
```

This will output

```

```

[![Travis Build Status](https://img.shields.io/travis/parro-it/iterate-fun/master.svg)](http://travis-ci.org/parro-it/iterate-fun)
[![NPM downloads](https://img.shields.io/npm/dt/iterate-fun.svg)](https://npmjs.org/package/iterate-fun)

## API

### iterateFunction

Return an iterable that continously call `fn` argument,
iterating over the results.

**Parameters**

- `fn` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the function that returns result iterable items.

**Examples**

```javascript
const arr = [42, 43, 44];
const result = iterateFunction(() => {
if (arr.length === 0) {
return Done;
}
return arr.shift() + 1;
});
// results === [43, 44, 45]
```

Returns **any** A new iterable that iterate over `fn` results.

## Install

With [npm](https://npmjs.org/) installed, run

$ npm install iterate-fun

## See Also

- [`noffle/common-readme`](https://github.com/noffle/common-readme)

## License

MIT