MCPcopy Index your code
hub / github.com/omkarcloud/botasaurus / normalizeData

Function normalizeData

js/botasaurus-js/src/output.ts:305–325  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

303 return readFile('temp.txt')
304}
305function normalizeData(data: any): any[] {
306 if (data === null || data === undefined) {
307 return []
308 } else if (Array.isArray(data)) {
309 const normalizedList: any[] = []
310 for (const item of data) {
311 if (item === null || item === undefined) {
312 continue
313 } else if (typeof item !== 'object' || Array.isArray(item)) {
314 normalizedList.push({ data: item })
315 } else {
316 normalizedList.push(item)
317 }
318 }
319 return normalizedList
320 } else if (typeof data === 'object') {
321 return [data]
322 } else {
323 return [{ data }]
324 }
325}
326
327function normalizeItem(fieldnames: string[], item: any) {
328 const filteredItem: { [key: string]: any} = {}

Callers 4

pushDataFunction · 0.90
pushMethod · 0.90
cleanDataFunction · 0.85
cleanDataInPlaceFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected