tfose5-xlsx 3.1.1 → 3.2.2

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 CHANGED
@@ -1 +1 @@
1
- # ![Version](https://img.shields.io/badge/version-3.1.1-green.svg)
1
+ # ![Version](https://img.shields.io/badge/version-3.2.2-green.svg)
@@ -1,2 +1,2 @@
1
1
  import { FsFactory } from 'tfose5-fs';
2
- export declare function parseXlsxToEnumJson(fsFactory: FsFactory, dstDirPath: string, srcDirPath: string): Promise<void>;
2
+ export declare function parseXlsxToEnumJson(fsFactory: FsFactory, dstDirPath: string, srcDirPath: string, topEnums?: string[]): Promise<void>;
@@ -23,23 +23,23 @@ const to_unix_converter_1 = require("./to-unix-converter");
23
23
  const to_value_converter_1 = require("./to-value-converter");
24
24
  const to_value_conditions_converter_1 = require("./to-value-conditions-converter");
25
25
  const allEnumTextNo = {};
26
- const enums = ['ViewEnum', 'ValueEnum'];
27
- const converterFactory = new converter_factory_1.ConverterFactory(new to_enum_no_converter_1.ToEnumNoConverter(allEnumTextNo), {
28
- bool: new to_bool_converter_1.ToBoolConverter(),
29
- conditions: new to_value_conditions_converter_1.ToValueConditionsConverter(allEnumTextNo, enums[1]),
30
- json: new to_json_converter_1.ToJsonConverter(),
31
- number: new to_number_converter_1.ToNumberConverter(),
32
- rewards: new to_rewards_converter_1.ToRewardsConverter(allEnumTextNo, enums[1]),
33
- unit: new to_unix_converter_1.ToUnixConverter(),
34
- value: new to_value_converter_1.ToValueConverter(allEnumTextNo, enums[1]),
35
- });
36
- function parseXlsxToEnumJson(fsFactory, dstDirPath, srcDirPath) {
37
- return __awaiter(this, void 0, void 0, function* () {
26
+ let converterFactory;
27
+ function parseXlsxToEnumJson(fsFactory_1, dstDirPath_1, srcDirPath_1) {
28
+ return __awaiter(this, arguments, void 0, function* (fsFactory, dstDirPath, srcDirPath, topEnums = ['ValueEnum']) {
38
29
  var _a;
30
+ converterFactory = new converter_factory_1.ConverterFactory(new to_enum_no_converter_1.ToEnumNoConverter(allEnumTextNo), {
31
+ bool: new to_bool_converter_1.ToBoolConverter(),
32
+ conditions: new to_value_conditions_converter_1.ToValueConditionsConverter(allEnumTextNo, topEnums[topEnums.length - 1]),
33
+ json: new to_json_converter_1.ToJsonConverter(),
34
+ number: new to_number_converter_1.ToNumberConverter(),
35
+ rewards: new to_rewards_converter_1.ToRewardsConverter(allEnumTextNo, topEnums[topEnums.length - 1]),
36
+ unit: new to_unix_converter_1.ToUnixConverter(),
37
+ value: new to_value_converter_1.ToValueConverter(allEnumTextNo, topEnums[topEnums.length - 1]),
38
+ });
39
39
  const filePaths = [];
40
40
  yield fsFactory.build(tfose5_fs_1.FsScanBase).scan({
41
41
  fileAction: (filePath) => __awaiter(this, void 0, void 0, function* () {
42
- const ok = enums.some(r => {
42
+ const ok = topEnums.some(r => {
43
43
  return filePath.includes(r);
44
44
  });
45
45
  if (ok)
@@ -48,7 +48,7 @@ function parseXlsxToEnumJson(fsFactory, dstDirPath, srcDirPath) {
48
48
  }),
49
49
  path: srcDirPath,
50
50
  });
51
- enums.forEach(r => {
51
+ topEnums.forEach(r => {
52
52
  filePaths.unshift((0, path_1.join)(srcDirPath, r + '.xlsx'));
53
53
  });
54
54
  for (const r of filePaths) {
@@ -89,9 +89,10 @@ function parseSheet(sheet, allOtherSheetRows) {
89
89
  fieldValue = ((_a = allOtherSheetRows[ext]) !== null && _a !== void 0 ? _a : []).filter(sr => {
90
90
  return cr[1] == sr.group;
91
91
  }).map(sr => {
92
- delete sr.group;
93
- delete sr.value;
94
- return sr;
92
+ const copy = structuredClone(sr);
93
+ delete copy.group;
94
+ delete copy.value;
95
+ return copy;
95
96
  });
96
97
  }
97
98
  else if (type == 'array') {
package/package.json CHANGED
@@ -2,8 +2,7 @@
2
2
  "author": "ahl5esoft",
3
3
  "dependencies": {
4
4
  "dayjs": "^1.11.20",
5
- "tfose5-error": "^1.0.0",
6
- "tfose5-fs": "^1.4.1",
5
+ "tfose5-fs": "^1.6.1",
7
6
  "xlsx": "^0.18.5"
8
7
  },
9
8
  "devDependencies": {
@@ -25,5 +24,5 @@
25
24
  "test": "mocha -t 30s -r ./node_modules/ts-node/register/index.js --exit",
26
25
  "version": "ts-node script version"
27
26
  },
28
- "version": "3.1.1"
27
+ "version": "3.2.2"
29
28
  }