2
0
Files
bot/packages/bot-engine/blocks/integrations/googleSheets/helpers/parseCellValues.ts
2023-09-20 15:42:34 +02:00

15 lines
442 B
TypeScript

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