MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / applyFunctionToResult

Function applyFunctionToResult

js/botasaurus-server-js/src/writer.ts:28–40  ·  view source on GitHub ↗
(result: any, fn: (item:any)=> any)

Source from the content-addressed store, hash-verified

26
27
28async function applyFunctionToResult(result: any, fn: (item:any)=> any) {
29 if (Array.isArray(result)) {
30 for (const item of result) {
31 await fn(item);
32 }
33 } else if (result != null && typeof result === 'object' && Symbol.iterator in result) {
34 for (const item of result) {
35 await fn(item);
36 }
37 } else {
38 return fn(result);
39 }
40}
41function createCsvItemWriterFn(streamFn: any, writer: any) {
42 let isPreStartCalled = false;
43

Callers 4

createCsvItemWriterFnFunction · 0.85
createJsonItemWriterFnFunction · 0.85
writeJsonFunction · 0.85
makeWorksheetStreamedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected