Skip to content

Possible internal interface update #778

Closed
@charlierudolph

Description

@charlierudolph

Instead of having three functions

each(arr, iterator, [callback])
eachSeries(arr, iterator, [callback])
eachLimit(arr, limit, iterator, [callback])

How about just having each take an optional object argument at the end

each(arr, iterator[, options][, callback])

To run series have options be {series: true}
To run with limit have options be {limit: 2}

The series option could even be removed as its equivalent to {limit: 1}

I think this would help simplify the library as the number of functions will be reduced but the power will still be there and additional options can easily be added.

This could be done as a non-breaking change as eachSeries and eachLimit are deprecated and each is extended to support the optional options argument.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions