Skip to content

Instantly share code, notes, and snippets.

@derekchiang
Last active December 17, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekchiang/5641941 to your computer and use it in GitHub Desktop.
Save derekchiang/5641941 to your computer and use it in GitHub Desktop.
A simple function for getting the extension of a filename.
getExtension = (filename) ->
i = filename.lastIndexOf '.'
return if i < 0 then '' else filename.substr (i+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment