MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / map

Function map

sdk/src/CloudSocketClientLib.js:3587–3601  ·  view source on GitHub ↗

* Async array map using after

(ary, each, done)

Source from the content-addressed store, hash-verified

3585 */
3586
3587 function map(ary, each, done) {
3588 var result = new Array(ary.length);
3589 var next = after(ary.length, done);
3590
3591 var eachWithIndex = function(i, el, cb) {
3592 each(el, function(error, msg) {
3593 result[i] = msg;
3594 cb(error, result);
3595 });
3596 };
3597
3598 for (var i = 0; i < ary.length; i++) {
3599 eachWithIndex(i, ary[i], next);
3600 }
3601 }
3602
3603 /*
3604 * Decodes data when a payload is maybe expected. Possible binary contents are

Callers 1

Calls 2

afterFunction · 0.70
eachWithIndexFunction · 0.70

Tested by

no test coverage detected