tfose5-xlsx 2.0.0 → 2.1.1
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/README.md +1 -1
- package/dist/cell-to-json-parser.d.ts +1 -1
- package/dist/cell-to-json-parser.js +1 -12
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/dist/file-parser-base.d.ts +0 -5
- package/dist/file-parser-base.js +0 -6
- package/dist/file-parser-parse-result.d.ts +0 -7
- package/dist/file-parser-parse-result.js +0 -2
- package/dist/file-parser.d.ts +0 -10
- package/dist/file-parser.js +0 -22
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# 
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XlsxCellParserParseOption } from './cell-parser-parse-option';
|
|
2
2
|
import { IXlsxParser } from './i-parser';
|
|
3
3
|
export declare class XlsxCellToJsonParser implements IXlsxParser<XlsxCellParserParseOption, unknown> {
|
|
4
|
-
parse(opt: XlsxCellParserParseOption):
|
|
4
|
+
parse(opt: XlsxCellParserParseOption): any;
|
|
5
5
|
}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.XlsxCellToJsonParser = void 0;
|
|
13
4
|
class XlsxCellToJsonParser {
|
|
14
5
|
parse(opt) {
|
|
15
|
-
return
|
|
16
|
-
return typeof opt.value == 'string' ? JSON.parse(opt.value) : opt.value;
|
|
17
|
-
});
|
|
6
|
+
return typeof opt.value == 'string' ? JSON.parse(opt.value) : opt.value;
|
|
18
7
|
}
|
|
19
8
|
}
|
|
20
9
|
exports.XlsxCellToJsonParser = XlsxCellToJsonParser;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './enum-sheet-parser-base';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './enum-sheet-parser-parse-option';
|
|
3
3
|
export * from './i-parser';
|
|
4
4
|
export * from './parser-factory';
|
|
5
|
+
export * from './work-book-parser-base';
|
|
6
|
+
export * from './work-book-parser-parse-result';
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./enum-sheet-parser-base"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./enum-sheet-parser-parse-option"), exports);
|
|
19
19
|
__exportStar(require("./i-parser"), exports);
|
|
20
20
|
__exportStar(require("./parser-factory"), exports);
|
|
21
|
+
__exportStar(require("./work-book-parser-base"), exports);
|
|
22
|
+
__exportStar(require("./work-book-parser-parse-result"), exports);
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { XlsxFileParserParseResult } from './file-parser-parse-result';
|
|
2
|
-
import { IXlsxParser } from './i-parser';
|
|
3
|
-
export declare abstract class XlsxFileParserBase implements IXlsxParser<string, XlsxFileParserParseResult> {
|
|
4
|
-
abstract parse(path: string): XlsxFileParserParseResult;
|
|
5
|
-
}
|
package/dist/file-parser-base.js
DELETED
package/dist/file-parser.d.ts
DELETED
package/dist/file-parser.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XlsxFileParser = void 0;
|
|
4
|
-
const xlsx_1 = require("xlsx");
|
|
5
|
-
const file_parser_base_1 = require("./file-parser-base");
|
|
6
|
-
class XlsxFileParser extends file_parser_base_1.XlsxFileParserBase {
|
|
7
|
-
parse(path) {
|
|
8
|
-
const wb = (0, xlsx_1.readFile)(path);
|
|
9
|
-
return {
|
|
10
|
-
sheets: wb.SheetNames.filter(r => {
|
|
11
|
-
return !r.includes('_');
|
|
12
|
-
}).map(r => {
|
|
13
|
-
return {
|
|
14
|
-
name: r,
|
|
15
|
-
rows: xlsx_1.utils.sheet_to_json(wb.Sheets[r]),
|
|
16
|
-
};
|
|
17
|
-
}).reverse(),
|
|
18
|
-
enumName: wb.SheetNames[0],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.XlsxFileParser = XlsxFileParser;
|