mapName2Sidecars = entries => {
  const result = {}
  entries.sort(bySize).forEach(entry => {
    const { name, ext } = parseNameExt(entry.filename)
    const { name: name2, ext: ext2 } = parseNameExt(name)
    if (ext && result[name]) {
      result[name].push(entry)
    } else if (ext2 && result[name2]) {
      result[name2].push(entry)
    } else if (ext) {
      result[name] = [entry]
    }
  })
  return result
}
Strip one or two extensions to group files with their sidecars, sorted by their size
The main file will be the largest one

Example: IMG_2635.AVI, IMG_2635.THM, IMG_2635.AVI.xmp -> group(IMG_2635)