Skip to content

Instantly share code, notes, and snippets.

@mcnaveen
Created August 6, 2023 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcnaveen/555855e43646c298cedb61ad459c0290 to your computer and use it in GitHub Desktop.
Save mcnaveen/555855e43646c298cedb61ad459c0290 to your computer and use it in GitHub Desktop.
Notion Helper Function to find property value by name
const findPropertyValue = (results, propertyName) => {
const property = results.find((item: { properties: { Key: { title: { text: { content }; }[]; }; }; }) => item.properties.Key.title[0].text.content === propertyName);
return property ? property.properties.Value.rich_text[0].text.content : null;
};
// then just do
const somevar = findPropertyValue(response.results, "My Phone Number")
// Table should follow this structure
https://imgur.com/a/P2kssZV
// Key in the Table should be "My Phone Number"
@mcnaveen
Copy link
Author

mcnaveen commented Aug 6, 2023

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment