MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / map

Function map

public/javascripts/socket.io.js:5880–5894  ·  view source on GitHub ↗

* Async array map using after

(ary, each, done)

Source from the content-addressed store, hash-verified

5878 */
5879
5880 function map(ary, each, done) {
5881 var result = new Array(ary.length);
5882 var next = after(ary.length, done);
5883
5884 var eachWithIndex = function(i, el, cb) {
5885 each(el, function(error, msg) {
5886 result[i] = msg;
5887 cb(error, result);
5888 });
5889 };
5890
5891 for (var i = 0; i < ary.length; i++) {
5892 eachWithIndex(i, ary[i], next);
5893 }
5894 }
5895
5896 /*
5897 * Decodes data when a payload is maybe expected. Possible binary contents are

Callers 1

socket.io.jsFile · 0.85

Calls 2

afterFunction · 0.85
eachWithIndexFunction · 0.85

Tested by

no test coverage detected