index.js
function getParentPath(path, sep) {
    if (!is.nonEmptyStr(path))  return false;
    if (!is.nonEmptyStr(sep))  sep = defaultSepChar;

    // create new path and remove leading and trailing sep chars
    var properties = filter(path.split(sep), function(elem) {
        return is.str(elem) && elem.length;
    });

    // create a parent path
    var parentPath = '';
    for (var i=0; i<properties.length-1; i++) {
        parentPath += properties[i];
        parentPath += (i < properties.length-2) ? sep : '';
    }

    return parentPath.length ? parentPath : false;
}
function getParentPath(path, sep) {
    if (!is.nonEmptyStr(path))  return false;
    if (!is.nonEmptyStr(sep))  sep = defaultSepChar;

    // create new path and remove leading and trailing sep chars
    var properties = filter(path.split(sep), function(elem) {
        return is.str(elem) && elem.length;
    });

    // create a parent path
    var parentPath = '';
    for (var i=0; i<properties.length-1; i++) {
        parentPath += properties[i];
        parentPath += (i < properties.length-2) ? sep : '';
    }

    return parentPath.length ? parentPath : false;
}
function getParentPath ( path , sep ) { if ( ! is . nonEmptyStr ( path ) ) return false ; if ( ! is . nonEmptyStr ( sep ) ) sep = defaultSepChar ; // create new path and remove leading and trailing sep chars var properties = filter ( path . split ( sep ) , function ( elem ) { return is . str ( elem ) && elem . length ; } ) ; // create a parent path var parentPath = '' ; for ( var i = 0 ; i < properties . length - 1 ; i ++ ) { parentPath += properties [ i ] ; parentPath += ( i < properties . length - 2 ) ? sep : '' ; } return parentPath . length ? parentPath : false ; }
Given a char separated object path, return the parent part of the path. Given
a path, return the parent path, for '1.2.3.4', the parent path would be
'1.2.3'.
@param {String} path The path for which which we want the parent.
@param {String} sep The separator character to separate path elements.
@return {String|Boolean} The parent to the path input parameter or false if there is no parent path.
Given a char separated object path return the parent part of the path . Given a path return the parent path for 1 . 2 . 3 . 4 the parent path would be 1 . 2 . 3 .