code: function isDir(fp, stat) {
    if (endsWith(fp, '/')) {
      return true;
    }
  
    if (stat === null) {
      // try to get the directory info if it hasn't been done yet
      // to ensure directories containing dots are well handle
      stat = tryStats(fp);
    }
  
    if (isObject(stat) && typeof stat.isDirectory === 'function') {
      return stat.isDirectory();
    }
  
    var segs = fp.split('/');
    var last = segs[segs.length - 1];
    if (last && last.indexOf('.') !== -1) {
      return false;
    }
    return true;
  }
docs: Returns true if `fp` is a directory. To use a `fs`
  stat object to actually check the file system,
  either pass `true` as the second arg, or pass your
  own stat object as the second arg.
  
  @param  {String} `fp`
  @param  {Boolean|Object} `stat`
  @return {Boolean}