@punks/backend-core 0.0.75 → 0.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -30999,17 +30999,14 @@ const aggregateRow = (header, row, options) => {
30999
30999
  return record;
31000
31000
  };
31001
31001
  const excelParse = (file, options) => {
31002
- const sheets = parseExcelRaw(file).map((x) => parseSheet(x, options));
31003
- return sheets.length === 1
31004
- ? sheets[0]
31005
- : sheets.reduce((acc, sheet, index) => {
31006
- acc[sheet.name || `Sheet${index + 1}`] = sheets[index];
31002
+ const sheets = parseExcelRaw(file).reduce((acc, sheet) => {
31003
+ if (options?.sheetFilter && !options.sheetFilter(sheet))
31007
31004
  return acc;
31008
- }, {});
31009
- };
31010
- const parseSheet = (sheet, options) => {
31011
- const [header, ...lines] = sheet.data.filter((x) => isValidRow(x));
31012
- return lines.map((x) => aggregateRow(header, x, options));
31005
+ const [header, ...rows] = sheet.data.filter((row) => isValidRow(row));
31006
+ acc.push(rows.map((row) => aggregateRow(header, row, options)));
31007
+ return acc;
31008
+ }, []);
31009
+ return sheets.length === 1 ? sheets[0] : sheets.flat();
31013
31010
  };
31014
31011
 
31015
31012
  const getLevelValue = (level) => {