@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 +11 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/xls.d.ts +1 -1
- package/dist/esm/index.js +11 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/xls.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -22,4 +22,4 @@ export type ExcelParseOptions = {
|
|
|
22
22
|
sheetIndex?: number;
|
|
23
23
|
dateColumns?: string[];
|
|
24
24
|
};
|
|
25
|
-
export declare const excelParse: (file: string | ArrayBuffer, options?: ExcelParseOptions) => any
|
|
25
|
+
export declare const excelParse: (file: string | ArrayBuffer, options?: ExcelParseOptions) => any;
|
package/dist/esm/index.js
CHANGED
|
@@ -30971,12 +30971,17 @@ const aggregateRow = (header, row, options) => {
|
|
|
30971
30971
|
return record;
|
|
30972
30972
|
};
|
|
30973
30973
|
const excelParse = (file, options) => {
|
|
30974
|
-
const sheets = parseExcelRaw(file);
|
|
30975
|
-
|
|
30976
|
-
|
|
30977
|
-
|
|
30978
|
-
|
|
30979
|
-
|
|
30974
|
+
const sheets = parseExcelRaw(file).map((x) => parseSheet(x, options));
|
|
30975
|
+
return sheets.length === 1
|
|
30976
|
+
? sheets[0]
|
|
30977
|
+
: sheets.reduce((acc, sheet, index) => {
|
|
30978
|
+
acc[sheet.name || `Sheet${index + 1}`] = sheets[index];
|
|
30979
|
+
return acc;
|
|
30980
|
+
}, {});
|
|
30981
|
+
};
|
|
30982
|
+
const parseSheet = (sheet, options) => {
|
|
30983
|
+
const [header, ...lines] = sheet.data.filter((x) => isValidRow(x));
|
|
30984
|
+
return lines.map((x) => aggregateRow(header, x, options));
|
|
30980
30985
|
};
|
|
30981
30986
|
|
|
30982
30987
|
const getLevelValue = (level) => {
|