Created
October 18, 2014 15:54
-
-
Save adnasa/94e26f50082454910657 to your computer and use it in GitHub Desktop.
get the file-extension
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
var nodePath = require('path'); | |
/** | |
* @param string filePath | |
* @return string filePath[extension] | |
*/ | |
var getFileExtension = function(filePath) { | |
var extension = nodePath.extname(filePath||'').split('.'); | |
return extension[extension.length - 1]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment