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
- Host: GitHub
- URL: https://github.com/parro-it/iterate-fun
- Owner: parro-it
- License: mit
- Created: 2017-04-13T19:42:54.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T19:49:06.000Z (almost 9 years ago)
- Last Synced: 2025-03-27T10:01:51.558Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
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
```
```
[](http://travis-ci.org/parro-it/iterate-fun)
[](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