nodejs/fn/string.js
/**
   * Returns the path of the folder containing the last hierarchical element of the path.
   *
   * @method   dirName
   * @global
   *
   * @example
   * ```javascript
   * //"folder/other_folder"
   * bbn.fn.dirName('folder/other_folder/file');
   * ```
   * @memberof bbn.fn
   * @param    {String} path
   * @returns  {String} path of the folder
   */
Returns the path of the folder containing the last hierarchical element of the path.
@method   dirName
@global


Returns the path of the folder containing the last hierarchical element of the path . @method dirName @global
dirName(path){
    if (bbn.fn.isString(path) && path) {
      while (path.substr(path.length-1) === '/') {
        path = path.substr(0, path.length-1);
      }
      let pos = path.lastIndexOf('/');
      if (pos > 0) {
        return path.substr(0, pos - 1);
      }
      if (pos === 0) {
        return '/';
      }
    }
    return '';
  }
dirName ( path ) { if ( bbn . fn . isString ( path ) && path ) { while ( path . substr ( path . length - 1 ) === '/' ) { path = path . substr ( 0 , path . length - 1 ) ; } let pos = path . lastIndexOf ( '/' ) ; if ( pos > 0 ) { return path . substr ( 0 , pos - 1 ) ; } if ( pos === 0 ) { return '/' ; } } return '' ; }
Returns the path of the folder containing the last hierarchical element of the path.
Returns the path of the folder containing the last hierarchical element of the path .