Created
July 19, 2013 18:09
-
-
Save jeshuamaxey/6041151 to your computer and use it in GitHub Desktop.
A JavaScript function which removes all compounded file extensions of a string eg
"file.js" => "file"
"file.min.js" => "file"
"file.v.0.04.min.js" => "file"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeExt(string) { | |
if(string == string.replace(/\.[^/.]+$/, '')) | |
return string; | |
else | |
return removeExt(string.replace(/\.[^/.]+$/, '')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment