@punks/backend-core 0.0.74 → 0.0.75

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,12 +30999,17 @@ const aggregateRow = (header, row, options) => {
30999
30999
  return record;
31000
31000
  };
31001
31001
  const excelParse = (file, options) => {
31002
- const sheets = parseExcelRaw(file);
31003
- const lines = sheets[0].data.filter((x) => isValidRow(x));
31004
- const header = lines[0];
31005
- return lines
31006
- .slice(1)
31007
- .map((x) => aggregateRow(header, x, 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];
31007
+ 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));
31008
31013
  };
31009
31014
 
31010
31015
  const getLevelValue = (level) => {