code: function parseFilepath(path) {
    if (path === undefined) {
      return {filename: null, list: []};
    }
  
    var list = path.split('/'),
        isDir = (path[path.length - 1] === '/') || (list[list.length - 1].indexOf('.') === -1);
  
    return {
      filename: isDir ? null : list.pop(),
      list: list
    };
  }
docs: split filepath from filename