Skip to content

kamiky/co-eachseries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-eachseries (Each series with ES6 generator co)

This package allow you to loop asynchronously over an array or object, step by step, similar to the async.eachSeries package.

Install

npm install co-eachseries --save

Install & Run example

npm install co-eachseries --dev

Example

const co = require('co')
const wait = require('co-wait')
const eachSeries = require('co-eachseries')

co(function* () {
  const array = ['one', 'two', 'three']
  const obj = {one: '1', two: '2', three:'3'} // work with object too
  try {
    yield eachSeries(array, function * (value, index) {
      console.log(value, index)
      yield wait(1000)
    })
  } catch (err) {
    console.log(err)
  }
})

About

Each series with ES6 generator co.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published