async-simple-iterator

Making simple iterator for async lib that adds beforeEach, afterEach, error hooks and support for settling. It also emits
beforeEach
,afterEach
anderror
events.
Install
npm i async-simple-iterator --save
Usage
For more use-cases see the tests
var base = // or get constructorvar AsyncSimpleIterator = AsyncSimpleIterator
API
AsyncSimpleIterator
Initialize
AsyncSimpleIterator
withoptions
.
Params
options
{Object=}: PassbeforeEach
,afterEach
anderror
hooks orsettle:true
.
Example
var ctrl = var AsyncSimpleIterator = AsyncSimpleIterator var fs = var base = settle: true { console } { console }var iterator = base ctrl
.wrapIterator
Wraps
iterator
function which then can be passed to async lib. You can pass returned iterator function to every async method that you want.
Params
iterator
{Function}: Iterator to pass to async lib.options
{Object=}: PassbeforeEach
,afterEach
anderror
hooks orsettle
option.returns
{Function}: Wrappediterator
function which can be passed to every async method.
Events
emits
:beforeEach
with signatureval[, value], next
emits
:afterEach
with signatureerr, res, val[, value], next
emits
:error
with signatureerr, res, val[, value], next
Example
var ctrl = var base = base var iterator = base ctrl
Related
- async: Higher-order functions and common patterns for asynchronous code | homepage
- async-base-iterator: Basic iterator for async library that handles async and synchronous… more | homepage
- async-control: Ultimate asynchronous control flow goodness with built-in hook system and… more | homepage
- relike: Simple promisify a callback-style function with sane defaults. Support promisify-ing… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.