Skip to content

Instantly share code, notes, and snippets.

@derekchiang
Created May 25, 2013 09:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
A little function that returns the basename of a filename.
baseName = (str) ->
base = new String(str).substring(str.lastIndexOf("/") + 1)
base = base.substring(0, base.lastIndexOf(".")) unless base.lastIndexOf(".") is -1
return base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment