UNPKG

@udus/notion-renderer

Version:
19 lines (18 loc) 636 B
export const convertResponseToRichTextPropertyItem = (property, client) => { return { ...property, rich_text: Array.isArray(property.rich_text) ? property.rich_text : [property.rich_text], }; }; export const convertListResponseToRichTextPropertyItem = (list, client) => { const rich_textPropertyItemObject = { ...list.property_item, rich_text: list.results .filter(isRichTextTypeObject) .map((result) => result.rich_text), }; return rich_textPropertyItemObject; }; export const isRichTextTypeObject = (obj) => obj.type === "rich_text";