1.1.0 • Published 7 years ago

loopasync v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Introduction

Loopasync is necessary for async iteration over any collection. Supported in Node as well as in browsers.

Use it when you have big data and you don't want to block event loop for a long time!

npm.io

Install

npm install loopasync --save

Node.js

// ES6 modules
import loopasync from 'loopasync';

// CommonJS modules
const loopasync = require('loopasync');

API

/*
  @param collection - collection for iteration
  @param iteratee - iterates over elements of collection and invokes iteratee for each element and index as a second param
  @param parts - number of parts collection will be split in (default will be calculated for you)
*/
loopasync(collection, iteratee[, parts]);

Usage

const loopasync = require('loopasync');

function testLoopasync() {
  console.log('start');

  const collection = [1, 2, 3, 4];
  const iteratee = console.log;
  const parts = 2;

  loopasync(collection, iteratee, parts);

  console.log('finish');
}

testLoopasync();

/*
// will print:
start
finish
1
2
3
4
*/

Contribution

Feel free to contribute

1.1.0

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago