MCPcopy
hub / github.com/apify/crawlee / map

Method map

packages/core/src/storages/dataset.ts:514–525  ·  view source on GitHub ↗

* Produces a new array of values by mapping each value in list through a transformation function `iteratee()`. * Each invocation of `iteratee()` is called with two arguments: `(element, index)`. * * If `iteratee` returns a `Promise` then it's awaited before a next call. * *

(iteratee: DatasetMapper<Data, R>, options: DatasetIteratorOptions = {})

Source from the content-addressed store, hash-verified

512 * @param [options] All `map()` parameters.
513 */
514 async map<R>(iteratee: DatasetMapper<Data, R>, options: DatasetIteratorOptions = {}): Promise<R[]> {
515 checkStorageAccess();
516
517 const result: R[] = [];
518
519 await this.forEach(async (item, index) => {
520 const res = await iteratee(item, index);
521 result.push(res);
522 }, options);
523
524 return result;
525 }
526
527 /**
528 * Reduces a list of values down to a single value.

Callers 15

extractUrlsFromCheerioFunction · 0.80
mergeAsyncIterablesFunction · 0.80
processBufferMethod · 0.80
loadMethod · 0.80
discoverValidSitemapsFunction · 0.80
parseOpenGraphPropertyFunction · 0.80
weightedAvgFunction · 0.80
snakeCaseToCamelCaseFunction · 0.80
social.tsFile · 0.80
parseHandlesFromHtmlFunction · 0.80
psTreeFunction · 0.80
containsSelectorsFunction · 0.80

Calls 3

forEachMethod · 0.95
checkStorageAccessFunction · 0.90
pushMethod · 0.80

Tested by 7

getURLDataFunction · 0.64
makeJSONFunction · 0.64
makeCSVFunction · 0.64
sFunction · 0.64
getUniqueRequestsFunction · 0.64
getRequestListForMockFunction · 0.64
requestHandlerFunction · 0.64