2
0
Files
bot/packages/bot-engine/blocks/integrations/googleSheets/helpers/parseNewRowObject.ts
2024-06-27 11:25:43 +02:00

15 lines
444 B
TypeScript

import { Variable, Cell } from '@typebot.io/schemas'
import { parseVariables } from '@typebot.io/variables/parseVariables'
export const parseNewRowObject =
(variables: Variable[]) =>
(cells: Cell[]): { [key: string]: string } =>
cells.reduce((row, cell) => {
return !cell.column || !cell.value
? row
: {
...row,
[cell.column]: parseVariables(variables)(cell.value),
}
}, {})