sec-edgar-api
Version:
Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.
46 lines (45 loc) • 1.45 kB
TypeScript
export interface Cell {
attributes: string;
rowSpan: number;
colSpan: number;
rowIndex: number;
colIndex: number;
tableCellIndex: number;
html: string;
isHeaderRowCell: boolean;
isBodyTitleRowCell: boolean;
valueParsed: string | number | null;
headerCol: string | null;
headerRowIndex: number | null;
}
export interface TableHTMLData {
tableIndex: number;
parentTableIndex: number | null;
childTableIndexes: number[];
positionStart: number;
positionEnd: number;
htmlBefore: string;
html: string;
rows: Cell[][];
}
interface ParseOptions {
tagsToExclude?: string[];
stripParenthesis?: boolean;
removeEmptyColumns?: boolean;
stripHtml?: boolean;
getHeaderRowIndex?: (data: {
rows: Omit<Cell, 'headerRowIndex' | 'isHeaderRowCell' | 'isBodyRowCell' | 'headerCol'>[][];
table: TableHTMLData;
}) => number;
}
export default class HtmlTableExtractor {
extractTables(html: string, options?: ParseOptions): TableHTMLData[];
mergeHeaderRows(tables: TableHTMLData[]): void;
removeEmptyColumns(tables: TableHTMLData[]): TableHTMLData[];
private addTableCells;
private addMissingNameCol;
private addTableCellValues;
stripHtml(str: string, options?: Omit<ParseOptions, 'stripHtml' | 'stripParenthesis'>): string;
parseValue(str: string | number | null, options?: ParseOptions): string | number | null;
}
export {};