html-table-to-dataframe
Version:
Convert HTML tables to data-frames
25 lines (24 loc) • 981 B
TypeScript
import { LocatorID, RowData, TableData, DataFrameOptions } from './types';
/**
* toDataFrame is a method, which when passed the table element via
* the data-test-id will serialize the data into a more usable object.
* The table requires the absolute header values to be processed, otherwise
* an error will be thrown.
*
* The structure should be rows of column titles and the corresponding value
* as a key/pair. Therefore a table header can be separated words e.g. "col two".
*
* | one | col two |
* | a | b |
* | c | 1 |
*
* This table will be converted and returned as a tableData:
*
* [ {"one":"a", "col two": "b"}, {"one":"c", "col two": "1"} ]
*
* NB; All values are considered strings.
*
* Call: convertHTMLTable(["one", "col two"])
*/
export declare function toDataFrame(html: string, options?: DataFrameOptions): TableData;
export declare function toInteractiveDataFrame(html: string, options?: DataFrameOptions): RowData<LocatorID>[];