Skip to content

Instantly share code, notes, and snippets.

@derekchiang
Created May 25, 2013 09:23
Show Gist options
  • Save derekchiang/5648495 to your computer and use it in GitHub Desktop.
Save derekchiang/5648495 to your computer and use it in GitHub Desktop.
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