import { Dataframe } from "../csv/read" const main = (df: Dataframe, label: string, map: (row: string[], rowAsHeadObject: Record) => any) => { df.body = df.body.map(row => { const rowAsHeadObject: Record = {} df.head.forEach((label, index) => rowAsHeadObject[label] = row[index]) const res = `${map(row, rowAsHeadObject)}` return [...row, res] }) df.head.push(label) } export default main