MCPcopy Create free account
hub / github.com/TruthHun/BookStack / map

Function map

static/word2md/mammoth.browser.js:6511–6534  ·  view source on GitHub ↗
(promises, fn, options, _filter)

Source from the content-addressed store, hash-verified

6509};
6510
6511function map(promises, fn, options, _filter) {
6512 if (typeof fn !== "function") {
6513 return apiRejection("expecting a function but got " + util.classString(fn));
6514 }
6515
6516 var limit = 0;
6517 if (options !== undefined) {
6518 if (typeof options === "object" && options !== null) {
6519 if (typeof options.concurrency !== "number") {
6520 return Promise.reject(
6521 new TypeError("'concurrency' must be a number but it is " +
6522 util.classString(options.concurrency)));
6523 }
6524 limit = options.concurrency;
6525 } else {
6526 return Promise.reject(new TypeError(
6527 "options argument must be an object but it is " +
6528 util.classString(options)));
6529 }
6530 }
6531 limit = typeof limit === "number" &&
6532 isFinite(limit) && limit >= 1 ? limit : 0;
6533 return new MappingPromiseArray(promises, fn, limit, _filter).promise();
6534}
6535
6536Promise.prototype.map = function (fn, options) {
6537 return map(this, fn, options, null);

Callers 1

mammoth.browser.jsFile · 0.70

Calls 3

funcFunction · 0.85
apiRejectionFunction · 0.70
ruleFunction · 0.70

Tested by

no test coverage detected