Created
August 6, 2023 15:55
-
-
Save mcnaveen/555855e43646c298cedb61ad459c0290 to your computer and use it in GitHub Desktop.
Notion Helper Function to find property value by name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Author
mcnaveen
commented
Aug 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment