Skip to content

Instantly share code, notes, and snippets.

@ValentaTomas
Created August 24, 2021 19:19
Show Gist options
  • Save ValentaTomas/8b081c08f34abbe0e889d70cca4e0648 to your computer and use it in GitHub Desktop.
Save ValentaTomas/8b081c08f34abbe0e889d70cca4e0648 to your computer and use it in GitHub Desktop.
Get the file extension
function getFileExtension(file: string) {
return file.slice((Math.max(0, file.lastIndexOf('.')) || Infinity) + 1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment