small fixes
This commit is contained in:
@ -113,14 +113,12 @@ class Extractor {
|
|||||||
let id = this._checkTaskId(taskid, this._tasks.length - 1);
|
let id = this._checkTaskId(taskid, this._tasks.length - 1);
|
||||||
if (id < 0) return;
|
if (id < 0) return;
|
||||||
let results = this._tasks[id].results
|
let results = this._tasks[id].results
|
||||||
results.unshift(this._tasks[id].fieldSelectors);
|
|
||||||
|
|
||||||
let exResults = new ExtractResult(results);
|
|
||||||
|
|
||||||
if (!results.length) {
|
if (!results.length) {
|
||||||
logger.info(`No result for task #${id}. Forget to call ".start()"?`);
|
logger.info(`No result for task #${id}. Forget to call ".start()"?`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
results.unshift(this._tasks[id].fieldSelectors);
|
||||||
|
let exResults = new ExtractResult(results);
|
||||||
let msg = `
|
let msg = `
|
||||||
Please confirm to download (${results.length - 1} items):
|
Please confirm to download (${results.length - 1} items):
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,9 @@ class ExtractResult {
|
|||||||
let data = rowsCount > 0 ? this._data.slice(0, rowsCount) : this._data;
|
let data = rowsCount > 0 ? this._data.slice(0, rowsCount) : this._data;
|
||||||
return data.slice().reduce(
|
return data.slice().reduce(
|
||||||
(csv, lineCells) => {
|
(csv, lineCells) => {
|
||||||
|
if (!lineCells || !lineCells.length) {
|
||||||
|
return csv + "\n";
|
||||||
|
}
|
||||||
let line = lineCells.reduce(
|
let line = lineCells.reduce(
|
||||||
(lineText, cell, idx) => {
|
(lineText, cell, idx) => {
|
||||||
cell = '"' + cell.trim().replace(/"/g, '""') + '"';
|
cell = '"' + cell.trim().replace(/"/g, '""') + '"';
|
||||||
|
|||||||
Reference in New Issue
Block a user