feat: maxlen 0 if field not exist

This commit is contained in:
Rohit
2025-04-29 20:49:24 +05:30
parent 01ab958b60
commit c7e3a66511

View File

@@ -49,9 +49,12 @@ function mergeRelatedData(serializableOutput: SerializableOutput, binaryOutput:
const mergedRecords: Record<string, any>[] = []; const mergedRecords: Record<string, any>[] = [];
const maxLength = Math.max( const maxLength = Math.max(
...(serializableOutput.scrapeSchema?.map(array => array?.length || 0) || [0]), ...[
...(serializableOutput.scrapeList?.map(array => array?.length || 0) || [0]), ...(serializableOutput.scrapeSchema ?? []).map(arr => arr?.length ?? 0),
...(serializableOutput.other?.map(array => array?.length || 0) || [0]) ...(serializableOutput.scrapeList ?? []).map(arr => arr?.length ?? 0),
...(serializableOutput.other ?? []).map(arr => arr?.length ?? 0),
0
]
); );
for (let i = 0; i < maxLength; i++) { for (let i = 0; i < maxLength; i++) {