lib/flatten-path.js
function flattenPath(file, opts) {
  var fileName = path.basename(file.path);
  var dirs;

  if (!opts.includeParents && !opts.subPath) {
    return fileName;
  }

  dirs = path.dirname(file.relative).split(path.sep);
  if (opts.includeParents) {
    dirs = includeParents(dirs, opts.includeParents);
  }
  if (opts.subPath) {
    dirs = subPath(dirs, opts.subPath);
  }

  dirs.push(fileName);
  return path.join.apply(path, dirs);
}
function flattenPath(file, opts) {
  var fileName = path.basename(file.path);
  var dirs;

  if (!opts.includeParents && !opts.subPath) {
    return fileName;
  }

  dirs = path.dirname(file.relative).split(path.sep);
  if (opts.includeParents) {
    dirs = includeParents(dirs, opts.includeParents);
  }
  if (opts.subPath) {
    dirs = subPath(dirs, opts.subPath);
  }

  dirs.push(fileName);
  return path.join.apply(path, dirs);
}
function flattenPath ( file , opts ) { var fileName = path . basename ( file . path ) ; var dirs ; if ( ! opts . includeParents && ! opts . subPath ) { return fileName ; } dirs = path . dirname ( file . relative ) . split ( path . sep ) ; if ( opts . includeParents ) { dirs = includeParents ( dirs , opts . includeParents ) ; } if ( opts . subPath ) { dirs = subPath ( dirs , opts . subPath ) ; } dirs . push ( fileName ) ; return path . join . apply ( path , dirs ) ; }
Flatten the path to the desired depth

@param {File} file - vinyl file
@param {Object} options
@return {String}
Flatten the path to the desired depth