You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a function which extracts the pageId in a consistent format (no dashes) and ignores any additional prefix (like my-page-about-e5a735e33baa458b988993b55a54ee54):
constpageIdRe=/\b([a-f0-9]{32})$/constpageId2Re=/\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$//** Extracts the notion page ID from a notion URL suffix */exportconstparsePageId=(id: string)=>{id=id.split('?')[0]constmatch=id.match(pageIdRe)if(match){returnmatch[1]}constmatch2=id.match(pageId2Re)if(match2){returnmatch2[1].replace(/-/g,'')}}
And some ava unit tests that will probably be useful:
Here's a function which extracts the pageId in a consistent format (no dashes) and ignores any additional prefix (like
my-page-about-e5a735e33baa458b988993b55a54ee54
):And some ava unit tests that will probably be useful:
The text was updated successfully, but these errors were encountered: