function dirname(path, separator) {
    if (separator === void 0) { separator = nativeSep; }
    var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\');
    if (idx === 0) {
        return '.';
    }
    else if (~idx === 0) {
        return path[0];
    }
    else if (~idx === path.length - 1) {
        return dirname(path.substring(0, path.length - 1));
    }
    else {
        var res = path.substring(0, ~idx);
        if (isWindows && res[res.length - 1] === ':') {
            res += separator; // make sure drive letters end with backslash
        }
        return res;
    }
}
/**
 * @param path the path to get the dirname from
 * @param separator the separator to use
 * @returns the directory name of a path.
 *
 */
@param path the path to get the dirname from
@param separator the separator to use
@returns the directory name of a path.
@param path the path to get the dirname from @param separator the separator to use @returns the directory name of a path .
function dirname(path, separator) {
    if (separator === void 0) { separator = nativeSep; }
    var idx = ~path.lastIndexOf('/') || ~path.lastIndexOf('\\');
    if (idx === 0) {
        return '.';
    }
    else if (~idx === 0) {
        return path[0];
    }
    else if (~idx === path.length - 1) {
        return dirname(path.substring(0, path.length - 1));
    }
    else {
        var res = path.substring(0, ~idx);
        if (isWindows && res[res.length - 1] === ':') {
            res += separator; 
        }
        return res;
    }
}
function dirname ( path , separator ) { if ( separator === void 0 ) { separator = nativeSep ; } var idx = ~ path . lastIndexOf ( '/' ) || ~ path . lastIndexOf ( '\\' ) ; if ( idx === 0 ) { return '.' ; } else if ( ~ idx === 0 ) { return path [ 0 ] ; } else if ( ~ idx === path . length - 1 ) { return dirname ( path . substring ( 0 , path . length - 1 ) ) ; } else { var res = path . substring ( 0 , ~ idx ) ; if ( isWindows && res [ res . length - 1 ] === ':' ) { res += separator ; } return res ; } }
@param path the path to get the dirname from
 @param separator the separator to use
 @returns the directory name of a path.
@param path the path to get the dirname from @param separator the separator to use @returns the directory name of a path .
// make sure drive letters end with backslash