Skip to content

Commit

Permalink
fixes error when dealing with tables with a single security designation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcardoso committed Jan 17, 2022
1 parent 9274fe6 commit d53b6de
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions bookmarklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,14 @@

// tables that start with the gray block

let grayTables;

if (grayTableStartIndices.length === 1) {
grayTables = [parentTable.slice()];
} else {
grayTables = grayTableStartIndices
.map((d, i) => {
if (i === grayTableStartIndices.length - 1) {
return parentTable.slice(d, parentTable.length);
} else {
return parentTable.slice(d, grayTableStartIndices[i + 1]);
}
});

}
const grayTables = grayTableStartIndices
.map((d, i) => {
if (i === grayTableStartIndices.length - 1) {
return parentTable.slice(d, parentTable.length);
} else {
return parentTable.slice(d, grayTableStartIndices[i + 1]);
}
});

grayTables.map(d => {
extractGrayTable(d, {
Expand Down Expand Up @@ -277,20 +270,14 @@

// tables that start with "security designation" bit

let secDesTables;

if (secDesTableStartIndices.length === 1) {
secDesTables = [grayTable.slice()];
} else {
secDesTables = secDesTableStartIndices
.map((d, i) => {
if (i === secDesTableStartIndices.length - 1) {
return grayTable.slice(d, grayTable.length);
} else {
return grayTable.slice(d, secDesTableStartIndices[i + 1]);
}
});
}
const secDesTables = secDesTableStartIndices
.map((d, i) => {
if (i === secDesTableStartIndices.length - 1) {
return grayTable.slice(d, grayTable.length);
} else {
return grayTable.slice(d, secDesTableStartIndices[i + 1]);
}
});

const issuerName = pageType === 'issuer' ? firstOrderName : secondOrderName,
insiderName = pageType === 'issuer' ? secondOrderName : firstOrderName;
Expand Down Expand Up @@ -370,7 +357,6 @@
// console.log(`rowData[${i}] equals td[${tdIndex}]`);
}


if (hasRemarks) rowData[rowData.length - 1] = generalRemarks[i]; // adds remarks if applicable

finalData.push(rowData);
Expand Down

0 comments on commit d53b6de

Please sign in to comment.