Loops.map()

Iterate over each item of an array to build a new transformed array.

Usage

Hover over inputs/exits for more info.

var Loops = require('machinepack-loops');


// Iterate over each item of an array to build a new transformed array.

Loops.map({

array: [],

worker: ,

data: '*',

series: false,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

array required

The array to loop over

worker required

The machine to run on each item in the array.

data

Optional data param for the worker

'*'
series

Whether to run worker on one item at a time (in series)

false

Exits

error

An unexpected error occurred.

success

OK.

(varies based on provided inputs)