Created
November 29, 2022 19:16
-
-
Save aashreys/48a0206f545e775b8aedbc67e9027d7b to your computer and use it in GitHub Desktop.
Check if a Figma URL is that of the current file
This file contains 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
export function isThisFile(url: string): boolean { | |
let formattedFilename = figma.root.name.trim() | |
formattedFilename = encodeURIComponent(formattedFilename).replace(/%20/g, '-') | |
let isThisFile = url.includes('figma.com') && url.includes(formattedFilename) | |
return isThisFile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment