Skip to content

Instantly share code, notes, and snippets.

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