pelican-jdr/src/utils/tables/tableUtils.ts
2023-02-11 19:46:58 +01:00

17 lines
450 B
TypeScript

import type { TableItem } from "./types";
export function getColumn(row: TableItem, colName: string) {
return row[colName];
}
export function forEachCols(rows: TableItem[], func: Function) {
rows.forEach((row: TableItem) => {
for (const colName in row) {
if (Object.prototype.hasOwnProperty.call(row, colName)) {
if (getColumn(row, colName)) {
func(colName, getColumn(row, colName));
}
}
}
});
}