src/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 (bbn.fn.substr(path, path.length-1) === '/') {
          path = bbn.fn.substr(path, 0, path.length-1);
        }
        let pos = path.lastIndexOf('/');
        if (pos > 0) {
          return bbn.fn.substr(path, 0, pos);
        }
        if (pos === 0) {
          return '/';
        }
      }
      return '';
    }
dirName ( path ) { if ( bbn . fn . isString ( path ) && path ) { while ( bbn . fn . substr ( path , path . length - 1 ) === '/' ) { path = bbn . fn . substr ( path , 0 , path . length - 1 ) ; } let pos = path . lastIndexOf ( '/' ) ; if ( pos > 0 ) { return bbn . fn . substr ( path , 0 , pos ) ; } 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 .