@eliwimmer/notion-api-tools
v1.0.10
Published
A collection of functions for helping in the processing of Notion API responses.
Downloads
19
Readme
A simple set of tools to help with handling Notion API responses.
Install:
npm i @eliwimmer/notion-api-tools
dbQuerySimple()
Returns an array with only the id and page title from a Query Database response. Pages without a title are returned as a string 'Unititled' to avoid undefined errors when using map or other looping methods. Page titles in a database query are deeply nested, and have a dynamic index and key. This script makes getting that info easy, without having to make an API call for each page int the results.
Usage:
const dbQuerySimple = require('@eliwimmer/notion-api-tools')
dbQuerySimple(response)
Returns:
[
{ id: 'Page ID', title: 'Page Name'},
{ id: 'Page ID', title: 'Untitled' },
{ id: 'Page ID', title: 'Page Name' },
{ id: 'Page ID', title: 'Page Name' }
]