UNPKG

@udus/notion-renderer

Version:
21 lines (20 loc) 663 B
import { notNullNorUndefined } from "../../../utils/utils.js"; import { fetchBlockList } from "../fetchBlockList.js"; export const convertTableResponseToBlock = async (block, client) => { if (block.has_children) { const { ok, data } = await fetchBlockList(client, { block_id: block.id }); if (ok) { const table_rows = data.filter((block) => notNullNorUndefined(block) && block.type === "table_row"); return { ...block, table: { ...block.table, table_rows, }, }; } } return { ...block, }; };