Possible function export fix?

This commit is contained in:
2024-01-15 07:20:19 +01:00
parent 3990e29927
commit 5c77b3d593
4 changed files with 6 additions and 3 deletions

View File

@@ -1,19 +0,0 @@
export const getPlaylistIdFromUrl = (url: string) => {
try {
const urlObject = new URL(url);
const [collectionName, playlistId] = urlObject.pathname
.split('/')
.filter(Boolean);
const isValidPlaylistUrl =
urlObject.hostname === 'open.spotify.com' &&
collectionName === 'playlist' &&
playlistId;
if (!isValidPlaylistUrl) return null;
return playlistId;
} catch {
return null;
}
};