@ca-plant-list/ca-plant-list 0.3.2 → 0.3.4
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/.vscode/settings.json +4 -2
- package/data/exceptions.json +0 -3
- package/data/glossary/calyx.md +1 -0
- package/data/glossary/ovary.md +3 -0
- package/data/glossary/pedicel.md +1 -0
- package/data/glossary/pistil.md +3 -0
- package/data/glossary/sepal.md +1 -0
- package/data/glossary/stigma.md +3 -0
- package/data/glossary/style.md +3 -0
- package/data/illustrations/inkscape/pistil.svg +156 -0
- package/data/synonyms.csv +8 -3
- package/data/taxa.csv +77 -72
- package/data/text/Calochortus-argillosus.md +1 -0
- package/data/text/Calochortus-luteus.md +1 -0
- package/data/text/Calochortus-venustus.md +1 -0
- package/data/text/Ceanothus-cuneatus-var-cuneatus.md +1 -0
- package/data/text/Ceanothus-leucodermis.md +1 -0
- package/data/text/Claytonia-parviflora.md +1 -0
- package/data/text/Claytonia-perfoliata.md +1 -0
- package/data/text/Collinsia-heterophylla-var-heterophylla.md +1 -0
- package/data/text/Delphinium-californicum-subsp-californicum.md +1 -0
- package/data/text/Delphinium-decorum-subsp-decorum.md +1 -0
- package/data/text/Delphinium-hesperium-subsp-hesperium.md +1 -0
- package/data/text/Delphinium-patens-subsp-patens.md +1 -0
- package/data/text/Galium-andrewsii-subsp-gatense.md +1 -0
- package/data/text/Helianthella-californica-var-californica.md +1 -0
- package/data/text/Helianthella-castanea.md +1 -0
- package/data/text/Iris-macrosiphon.md +1 -0
- package/data/text/Lasthenia-californica-subsp-californica.md +1 -0
- package/data/text/Lasthenia-gracilis.md +1 -0
- package/data/text/Leptosiphon-ambiguus.md +1 -0
- package/data/text/Leptosiphon-androsaceus.md +1 -0
- package/data/text/Leptosiphon-bicolor.md +1 -1
- package/data/text/Leptosiphon-parviflorus.md +1 -0
- package/data/text/Lithophragma-affine.md +1 -1
- package/data/text/Lithophragma-parviflorum-var-parviflorum.md +1 -1
- package/data/text/Lomatium-californicum.md +0 -0
- package/data/text/Lomatium-dasycarpum-subsp-dasycarpum.md +1 -0
- package/data/text/Lomatium-utriculatum.md +1 -0
- package/data/text/Nemophila-heterophylla.md +1 -0
- package/data/text/Nemophila-parviflora-var-parviflora.md +1 -0
- package/data/text/Plectritis-ciliosa.md +1 -0
- package/data/text/Plectritis-macrocera.md +1 -0
- package/data/text/Primula-clevelandii-var-patula.md +1 -0
- package/data/text/Primula-hendersonii.md +1 -0
- package/data/text/Sidalcea-diploscypha.md +1 -0
- package/data/text/Thysanocarpus-curvipes.md +1 -0
- package/data/text/Thysanocarpus-laciniatus.md +1 -0
- package/data/text/Viola-douglasii.md +1 -0
- package/data/text/Viola-pedunculata.md +1 -0
- package/data/text/Viola-purpurea-subsp-quercetorum.md +1 -0
- package/ebook/css/main.css +5 -0
- package/lib/basepagerenderer.js +30 -29
- package/lib/dateutils.js +36 -16
- package/lib/ebook/pages/page_list_families.js +15 -9
- package/lib/ebook/pages/taxonpage.js +63 -36
- package/lib/ebook/plantbook.js +82 -48
- package/lib/errorlog.js +16 -11
- package/lib/families.js +109 -74
- package/lib/files.js +103 -45
- package/lib/genera.js +40 -26
- package/lib/generictaxaloader.js +15 -7
- package/lib/index.js +38 -3
- package/lib/taxa.js +174 -87
- package/lib/taxaloader.js +28 -15
- package/lib/taxaprocessor.js +6 -8
- package/lib/taxon.js +115 -57
- package/package.json +4 -6
- package/scripts/build-ebook.js +33 -25
- package/lib/index.d.ts +0 -345
package/lib/index.js
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {{
|
3
|
+
* bloom_end:string;
|
4
|
+
* bloom_start:string;
|
5
|
+
* calrecnum:string;
|
6
|
+
* CESA:string;
|
7
|
+
* CRPR:string;
|
8
|
+
* "common name":string;
|
9
|
+
* FESA:string;
|
10
|
+
* flower_color:string;
|
11
|
+
* GRank:string;
|
12
|
+
* "inat id":string;
|
13
|
+
* "jepson id":string;
|
14
|
+
* SRank:string;
|
15
|
+
* status:string;
|
16
|
+
* "RPI ID":string;
|
17
|
+
* taxon_name:string}} TaxonData
|
18
|
+
*/
|
19
|
+
|
1
20
|
import { BasePageRenderer } from "./basepagerenderer.js";
|
2
21
|
import { CommandProcessor } from "./commandprocessor.js";
|
3
22
|
import { CommandAndTaxaProcessor } from "./commandandtaxaprocessor.js";
|
@@ -17,6 +36,22 @@ import { TaxaProcessor } from "./taxaprocessor.js";
|
|
17
36
|
import { Taxon, TAXA_COLNAMES } from "./taxon.js";
|
18
37
|
|
19
38
|
export {
|
20
|
-
BasePageRenderer,
|
21
|
-
|
22
|
-
|
39
|
+
BasePageRenderer,
|
40
|
+
CommandProcessor,
|
41
|
+
CommandAndTaxaProcessor,
|
42
|
+
Config,
|
43
|
+
CSV,
|
44
|
+
ErrorLog,
|
45
|
+
Exceptions,
|
46
|
+
Families,
|
47
|
+
Files,
|
48
|
+
GenericTaxaLoader,
|
49
|
+
HTML,
|
50
|
+
Jekyll,
|
51
|
+
PlantBook,
|
52
|
+
Taxa,
|
53
|
+
TaxaLoader,
|
54
|
+
TaxaProcessor,
|
55
|
+
TAXA_COLNAMES,
|
56
|
+
Taxon,
|
57
|
+
};
|
package/lib/taxa.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Config } from "./config.js";
|
2
|
-
import { Taxon } from "./taxon.js";
|
3
2
|
import { HTML } from "./html.js";
|
4
3
|
import { CSV } from "./csv.js";
|
5
4
|
import { RarePlants } from "./rareplants.js";
|
5
|
+
import { ErrorLog, Families, Taxon } from "./index.js";
|
6
|
+
import { Genera } from "./genera.js";
|
6
7
|
|
7
8
|
const FLOWER_COLORS = [
|
8
9
|
{ name: "white", color: "white" },
|
@@ -12,52 +13,68 @@ const FLOWER_COLORS = [
|
|
12
13
|
{ name: "yellow", color: "yellow" },
|
13
14
|
{ name: "blue", color: "blue" },
|
14
15
|
{ name: "purple", color: "purple" },
|
16
|
+
{ name: "green", color: "green" },
|
15
17
|
];
|
16
18
|
|
19
|
+
/**
|
20
|
+
* @type {Object.<string,import("./index.js").TaxaCol>}
|
21
|
+
*/
|
17
22
|
const TAXA_LIST_COLS = {
|
18
23
|
CESA: {
|
19
24
|
title: "California",
|
20
|
-
data: (
|
25
|
+
data: (t) => RarePlants.getCESADescription(t.getCESA()),
|
21
26
|
},
|
22
27
|
COMMON_NAME: {
|
23
28
|
title: "Common Name",
|
24
|
-
data: (
|
29
|
+
data: (t) => t.getCommonNames().join(", "),
|
25
30
|
},
|
26
31
|
CNPS_RANK: {
|
27
32
|
title: "CNPS Rank",
|
28
|
-
data: (
|
33
|
+
data: (t) =>
|
34
|
+
HTML.getToolTip(
|
35
|
+
HTML.textElement("span", t.getRPIRankAndThreat()),
|
36
|
+
t.getRPIRankAndThreatTooltip()
|
37
|
+
),
|
29
38
|
},
|
30
39
|
FESA: {
|
31
40
|
title: "Federal",
|
32
|
-
data: (
|
41
|
+
data: (t) => RarePlants.getFESADescription(t.getFESA()),
|
33
42
|
},
|
34
43
|
SPECIES: {
|
35
44
|
title: "Species",
|
36
|
-
data: (
|
45
|
+
data: (t) => t.getHTMLLink(true, true),
|
37
46
|
},
|
38
47
|
SPECIES_BARE: {
|
39
48
|
title: "Species",
|
40
|
-
data: (
|
49
|
+
data: (t) => t.getHTMLLink(true, false),
|
41
50
|
},
|
42
51
|
};
|
43
52
|
|
44
|
-
const DEFAULT_COLUMNS = [
|
53
|
+
const DEFAULT_COLUMNS = [TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME];
|
45
54
|
|
46
55
|
class FlowerColor {
|
47
|
-
|
48
56
|
#color;
|
57
|
+
/** @type {Taxon[]} */
|
49
58
|
#taxa = [];
|
50
59
|
|
51
|
-
|
60
|
+
/**
|
61
|
+
* @param {string} color
|
62
|
+
*/
|
63
|
+
constructor(color) {
|
52
64
|
this.#color = color;
|
53
65
|
}
|
54
66
|
|
55
|
-
|
56
|
-
|
67
|
+
/**
|
68
|
+
* @param {Taxon} taxon
|
69
|
+
*/
|
70
|
+
addTaxon(taxon) {
|
71
|
+
this.#taxa.push(taxon);
|
57
72
|
}
|
58
73
|
|
59
|
-
getColorName(
|
60
|
-
return uc
|
74
|
+
getColorName(uc = false) {
|
75
|
+
return uc
|
76
|
+
? this.#color[0].toUpperCase() + this.#color.substring(1)
|
77
|
+
: this.#color;
|
61
78
|
}
|
62
79
|
|
63
80
|
getFileName() {
|
@@ -67,67 +84,103 @@ class FlowerColor {
|
|
67
84
|
getTaxa() {
|
68
85
|
return this.#taxa;
|
69
86
|
}
|
70
|
-
|
71
87
|
}
|
72
88
|
|
73
89
|
class Taxa {
|
74
|
-
|
90
|
+
#families;
|
75
91
|
#errorLog;
|
92
|
+
/** @type {Object<string,Taxon>} */
|
76
93
|
#taxa = {};
|
94
|
+
/** @type {Object<string,FlowerColor>} */
|
77
95
|
#flower_colors = {};
|
78
96
|
#sortedTaxa;
|
79
97
|
#synonyms = new Set();
|
80
98
|
#isSubset;
|
81
99
|
|
82
|
-
|
83
|
-
|
84
|
-
|
100
|
+
/**
|
101
|
+
*
|
102
|
+
* @param {*} inclusionList
|
103
|
+
* @param {ErrorLog} errorLog
|
104
|
+
* @param {*} showFlowerErrors
|
105
|
+
* @param {*} taxaMeta
|
106
|
+
* @param {*} taxonClass
|
107
|
+
* @param {*} extraTaxa
|
108
|
+
* @param {*} extraSynonyms
|
109
|
+
*/
|
110
|
+
constructor(
|
111
|
+
inclusionList,
|
112
|
+
errorLog,
|
113
|
+
showFlowerErrors,
|
114
|
+
taxaMeta = {},
|
115
|
+
taxonClass = Taxon,
|
116
|
+
extraTaxa = [],
|
117
|
+
extraSynonyms = []
|
118
|
+
) {
|
119
|
+
this.#isSubset = inclusionList !== true;
|
85
120
|
|
86
121
|
this.#errorLog = errorLog;
|
87
122
|
|
88
|
-
for (
|
89
|
-
this.#flower_colors[
|
123
|
+
for (const color of FLOWER_COLORS) {
|
124
|
+
this.#flower_colors[color.name] = new FlowerColor(color.name);
|
90
125
|
}
|
91
126
|
|
92
127
|
const dataDir = Config.getPackageDir() + "/data";
|
93
128
|
|
94
|
-
|
95
|
-
|
96
|
-
|
129
|
+
this.#families = new Families();
|
130
|
+
|
131
|
+
const taxaCSV = CSV.parseFile(dataDir, "taxa.csv");
|
132
|
+
this.#loadTaxa(
|
133
|
+
taxaCSV,
|
134
|
+
inclusionList,
|
135
|
+
taxaMeta,
|
136
|
+
taxonClass,
|
137
|
+
showFlowerErrors
|
138
|
+
);
|
139
|
+
this.#loadTaxa(
|
140
|
+
extraTaxa,
|
141
|
+
inclusionList,
|
142
|
+
taxaMeta,
|
143
|
+
taxonClass,
|
144
|
+
showFlowerErrors
|
145
|
+
);
|
97
146
|
|
98
147
|
// Make sure everything in the inclusionList has been loaded.
|
99
|
-
for (
|
100
|
-
if (
|
101
|
-
this.#errorLog.log(
|
148
|
+
for (const name of Object.keys(inclusionList)) {
|
149
|
+
if (!this.getTaxon(name)) {
|
150
|
+
this.#errorLog.log(name, "not found in taxon list");
|
102
151
|
}
|
103
152
|
}
|
104
153
|
|
105
|
-
this.#sortedTaxa = Object.values(
|
106
|
-
|
107
|
-
|
108
|
-
this.#loadSyns( synCSV, inclusionList );
|
109
|
-
this.#loadSyns( extraSynonyms, inclusionList );
|
154
|
+
this.#sortedTaxa = Object.values(this.#taxa).sort((a, b) =>
|
155
|
+
a.getName().localeCompare(b.getName())
|
156
|
+
);
|
110
157
|
|
158
|
+
const synCSV = CSV.parseFile(dataDir, "synonyms.csv");
|
159
|
+
this.#loadSyns(synCSV, inclusionList);
|
160
|
+
this.#loadSyns(extraSynonyms, inclusionList);
|
111
161
|
}
|
112
162
|
|
113
|
-
|
114
|
-
|
163
|
+
/**
|
164
|
+
* @param {Taxon[]} taxa
|
165
|
+
* @param {import("./index.js").TaxaCol[]} columns
|
166
|
+
*/
|
167
|
+
static getHTMLTable(taxa, columns = DEFAULT_COLUMNS) {
|
115
168
|
let html = "<table><thead>";
|
116
|
-
for (
|
169
|
+
for (const col of columns) {
|
117
170
|
const className = col.class;
|
118
171
|
const atts = className ? { class: className } : {};
|
119
|
-
html += HTML.textElement(
|
172
|
+
html += HTML.textElement("th", col.title, atts);
|
120
173
|
}
|
121
174
|
html += "</thead>";
|
122
175
|
html += "<tbody>";
|
123
176
|
|
124
|
-
for (
|
177
|
+
for (const taxon of taxa) {
|
125
178
|
html += "<tr>";
|
126
|
-
for (
|
127
|
-
const data = col.data(
|
179
|
+
for (const col of columns) {
|
180
|
+
const data = col.data(taxon);
|
128
181
|
const className = col.class;
|
129
182
|
const atts = className ? { class: className } : {};
|
130
|
-
html += HTML.wrap(
|
183
|
+
html += HTML.wrap("td", data, atts);
|
131
184
|
}
|
132
185
|
html += "</tr>";
|
133
186
|
}
|
@@ -138,28 +191,41 @@ class Taxa {
|
|
138
191
|
return html;
|
139
192
|
}
|
140
193
|
|
141
|
-
|
142
|
-
return this.#
|
194
|
+
getFamilies() {
|
195
|
+
return this.#families;
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* @param {string} name
|
200
|
+
*/
|
201
|
+
getFlowerColor(name) {
|
202
|
+
return this.#flower_colors[name];
|
143
203
|
}
|
144
204
|
|
145
205
|
static getFlowerColorNames() {
|
146
|
-
return FLOWER_COLORS.map(
|
206
|
+
return FLOWER_COLORS.map((o) => o.name);
|
147
207
|
}
|
148
208
|
|
149
209
|
static getFlowerColors() {
|
150
210
|
return FLOWER_COLORS;
|
151
211
|
}
|
152
212
|
|
153
|
-
|
154
|
-
|
213
|
+
/**
|
214
|
+
* @param {string} name
|
215
|
+
*/
|
216
|
+
getTaxon(name) {
|
217
|
+
return this.#taxa[name];
|
155
218
|
}
|
156
219
|
|
157
220
|
getTaxonList() {
|
158
221
|
return this.#sortedTaxa;
|
159
222
|
}
|
160
223
|
|
161
|
-
|
162
|
-
|
224
|
+
/**
|
225
|
+
* @param {string} formerName
|
226
|
+
*/
|
227
|
+
hasSynonym(formerName) {
|
228
|
+
return this.#synonyms.has(formerName);
|
163
229
|
}
|
164
230
|
|
165
231
|
/**
|
@@ -170,75 +236,96 @@ class Taxa {
|
|
170
236
|
return this.#isSubset;
|
171
237
|
}
|
172
238
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
239
|
+
/**
|
240
|
+
* @param {*} synCSV
|
241
|
+
* @param {*} inclusionList
|
242
|
+
*/
|
243
|
+
#loadSyns(synCSV, inclusionList) {
|
244
|
+
for (const syn of synCSV) {
|
245
|
+
const currName = syn["Current"];
|
246
|
+
const taxon = this.getTaxon(currName);
|
247
|
+
if (!taxon) {
|
248
|
+
if (inclusionList === true && !syn.Type) {
|
179
249
|
// If including all taxa, note the error - the target is not defined, and this is not
|
180
250
|
// a synonym for a non-Jepson system.
|
181
|
-
console.log(
|
251
|
+
console.log("synonym target not found: " + currName);
|
182
252
|
}
|
183
253
|
continue;
|
184
254
|
}
|
185
|
-
const formerName = syn[
|
186
|
-
this.#synonyms.add(
|
187
|
-
taxon.addSynonym(
|
255
|
+
const formerName = syn["Former"];
|
256
|
+
this.#synonyms.add(formerName);
|
257
|
+
taxon.addSynonym(formerName, syn["Type"]);
|
188
258
|
}
|
189
259
|
}
|
190
260
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
261
|
+
/**
|
262
|
+
* @param {*} taxaCSV
|
263
|
+
* @param {*} inclusionList
|
264
|
+
* @param {*} taxaMeta
|
265
|
+
* @param {Taxon} taxonClass
|
266
|
+
* @param {boolean} showFlowerErrors
|
267
|
+
*/
|
268
|
+
#loadTaxa(taxaCSV, inclusionList, taxaMeta, taxonClass, showFlowerErrors) {
|
269
|
+
const genera = new Genera(this.#families);
|
270
|
+
for (const row of taxaCSV) {
|
271
|
+
const name = row["taxon_name"];
|
195
272
|
|
196
273
|
let taxon_overrides = {};
|
197
|
-
if (
|
198
|
-
taxon_overrides = inclusionList[
|
199
|
-
if (
|
274
|
+
if (inclusionList !== true) {
|
275
|
+
taxon_overrides = inclusionList[name];
|
276
|
+
if (!taxon_overrides) {
|
200
277
|
continue;
|
201
278
|
}
|
202
279
|
}
|
203
280
|
|
204
|
-
if (
|
205
|
-
this.#errorLog.log(
|
281
|
+
if (this.#taxa[name]) {
|
282
|
+
this.#errorLog.log(name, "has multiple entries");
|
206
283
|
}
|
207
284
|
|
208
|
-
const status = taxon_overrides[
|
209
|
-
if (
|
210
|
-
row[
|
285
|
+
const status = taxon_overrides["status"];
|
286
|
+
if (status !== undefined) {
|
287
|
+
row["status"] = status;
|
211
288
|
}
|
212
|
-
const taxon = new taxonClass(
|
213
|
-
this.#taxa[
|
289
|
+
const taxon = new taxonClass(row, genera, taxaMeta[name]);
|
290
|
+
this.#taxa[name] = taxon;
|
214
291
|
const colors = taxon.getFlowerColors();
|
215
|
-
if (
|
216
|
-
for (
|
217
|
-
const color = this.#flower_colors[
|
218
|
-
if (
|
219
|
-
throw new Error(
|
292
|
+
if (colors) {
|
293
|
+
for (const colorName of colors) {
|
294
|
+
const color = this.#flower_colors[colorName];
|
295
|
+
if (!color) {
|
296
|
+
throw new Error(
|
297
|
+
'flower color "' + colorName + '" not found'
|
298
|
+
);
|
220
299
|
}
|
221
|
-
color.addTaxon(
|
300
|
+
color.addTaxon(taxon);
|
222
301
|
}
|
223
302
|
}
|
224
303
|
|
225
|
-
if (
|
304
|
+
if (showFlowerErrors) {
|
226
305
|
// Make sure flower colors/bloom times are present or not depending on taxon.
|
227
|
-
if (
|
228
|
-
if (
|
229
|
-
|
306
|
+
if (taxon.shouldHaveFlowers()) {
|
307
|
+
if (
|
308
|
+
!colors ||
|
309
|
+
!taxon.getBloomStart() ||
|
310
|
+
!taxon.getBloomEnd()
|
311
|
+
) {
|
312
|
+
this.#errorLog.log(
|
313
|
+
name,
|
314
|
+
"does not have all flower info"
|
315
|
+
);
|
230
316
|
}
|
231
317
|
} else {
|
232
|
-
if (
|
233
|
-
|
318
|
+
if (
|
319
|
+
colors ||
|
320
|
+
taxon.getBloomStart() ||
|
321
|
+
taxon.getBloomEnd()
|
322
|
+
) {
|
323
|
+
this.#errorLog.log(name, "should not have flower info");
|
234
324
|
}
|
235
325
|
}
|
236
326
|
}
|
237
327
|
}
|
238
|
-
|
239
328
|
}
|
240
|
-
|
241
|
-
|
242
329
|
}
|
243
330
|
|
244
|
-
export { Taxa, TAXA_LIST_COLS };
|
331
|
+
export { Taxa, TAXA_LIST_COLS };
|
package/lib/taxaloader.js
CHANGED
@@ -1,35 +1,48 @@
|
|
1
|
-
import { CSV } from "./csv.js";
|
2
|
-
import { Files } from "./files.js";
|
3
1
|
import { GenericTaxaLoader } from "./generictaxaloader.js";
|
4
|
-
import { Taxa } from "./
|
2
|
+
import { CSV, Files, Taxa } from "./index.js";
|
5
3
|
|
6
4
|
class TaxaLoader extends GenericTaxaLoader {
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
/**
|
6
|
+
* @param {*} options
|
7
|
+
*/
|
8
|
+
constructor(options) {
|
9
|
+
super(options);
|
10
10
|
}
|
11
11
|
|
12
|
+
/**
|
13
|
+
* @return {Promise<Taxa>}
|
14
|
+
*/
|
12
15
|
async loadTaxa() {
|
13
|
-
|
16
|
+
/**
|
17
|
+
*
|
18
|
+
* @param {string} dataDir
|
19
|
+
* @returns
|
20
|
+
*/
|
21
|
+
function getIncludeList(dataDir) {
|
14
22
|
// Read inclusion list.
|
15
23
|
const includeFileName = "taxa_include.csv";
|
16
24
|
const includeFilePath = dataDir + "/" + includeFileName;
|
17
|
-
if (
|
18
|
-
console.log(
|
25
|
+
if (!Files.exists(includeFilePath)) {
|
26
|
+
console.log(includeFilePath + " not found; loading all taxa");
|
19
27
|
return true;
|
20
28
|
}
|
21
|
-
|
29
|
+
/**@type { import("./index.js").TaxonData[]} */
|
30
|
+
const includeCSV = CSV.parseFile(dataDir, includeFileName);
|
31
|
+
/** @type {Object<string,import("./index.js").TaxonData>} */
|
22
32
|
const include = {};
|
23
|
-
for (
|
24
|
-
include[
|
33
|
+
for (const row of includeCSV) {
|
34
|
+
include[row["taxon_name"]] = row;
|
25
35
|
}
|
26
36
|
return include;
|
27
37
|
}
|
28
38
|
|
29
39
|
const options = this.getOptions();
|
30
|
-
return new Taxa(
|
40
|
+
return new Taxa(
|
41
|
+
getIncludeList(options.datadir),
|
42
|
+
this.getErrorLog(),
|
43
|
+
options["show-flower-errors"]
|
44
|
+
);
|
31
45
|
}
|
32
|
-
|
33
46
|
}
|
34
47
|
|
35
|
-
export { TaxaLoader };
|
48
|
+
export { TaxaLoader };
|
package/lib/taxaprocessor.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import { TaxaLoader } from "./taxaloader.js";
|
2
2
|
|
3
3
|
class TaxaProcessor {
|
4
|
-
|
5
4
|
#options;
|
6
5
|
#taxaLoaderClass;
|
7
6
|
#taxaLoader;
|
8
7
|
|
9
|
-
constructor(
|
8
|
+
constructor(options, taxaLoaderClass = TaxaLoader) {
|
10
9
|
this.#options = options;
|
11
10
|
this.#taxaLoaderClass = taxaLoaderClass;
|
12
11
|
}
|
@@ -23,14 +22,13 @@ class TaxaProcessor {
|
|
23
22
|
return this.#taxaLoader.getTaxa();
|
24
23
|
}
|
25
24
|
|
26
|
-
async process(
|
27
|
-
console.log(
|
28
|
-
this.#taxaLoader = new this.#taxaLoaderClass(
|
25
|
+
async process(commandRunner) {
|
26
|
+
console.log("loading data");
|
27
|
+
this.#taxaLoader = new this.#taxaLoaderClass(this.#options);
|
29
28
|
await this.#taxaLoader.load();
|
29
|
+
await commandRunner(this);
|
30
30
|
this.#taxaLoader.writeErrorLog();
|
31
|
-
await commandRunner( this );
|
32
31
|
}
|
33
|
-
|
34
32
|
}
|
35
33
|
|
36
|
-
export { TaxaProcessor };
|
34
|
+
export { TaxaProcessor };
|