src/file/FileUtils.js
function getBaseName(fullPath) {
        var lastSlash = fullPath.lastIndexOf("/");
        if (lastSlash === fullPath.length - 1) {  // directory: exclude trailing "/" too
            return fullPath.slice(fullPath.lastIndexOf("/", fullPath.length - 2) + 1, -1);
        } else {
            return fullPath.slice(lastSlash + 1);
        }
    }
function getBaseName(fullPath) {
        var lastSlash = fullPath.lastIndexOf("/");
        if (lastSlash === fullPath.length - 1) {  // directory: exclude trailing "/" too
            return fullPath.slice(fullPath.lastIndexOf("/", fullPath.length - 2) + 1, -1);
        } else {
            return fullPath.slice(lastSlash + 1);
        }
    }
function getBaseName ( fullPath ) { var lastSlash = fullPath . lastIndexOf ( "/" ) ; if ( lastSlash === fullPath . length - 1 ) { // directory: exclude trailing "/" too return fullPath . slice ( fullPath . lastIndexOf ( "/" , fullPath . length - 2 ) + 1 , - 1 ) ; } else { return fullPath . slice ( lastSlash + 1 ) ; } }
Get the name of a file or a directory, removing any preceding path.
@param {string} fullPath full path to a file or directory
@return {string} Returns the base name of a file or the name of a
directory
Get the name of a file or a directory removing any preceding path .