Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80542 views
1
module.exports = function (xs, fn) {
2
var res = [];
3
for (var i = 0; i < xs.length; i++) {
4
var x = fn(xs[i], i);
5
if (Array.isArray(x) res.push.apply(res, x);
6
else res.push(x);
7
}
8
return res;
9
};
10
11