findHeads = (entries) => {
  entries = new Set(entries)
  const items = {}
  for (const entry of entries) {
    for (const next of entry.next) {
      items[next] = entry.hash
    }
  }

  const res = []
  for (const entry of entries) {
    if (!items[entry.hash]) {
      res.push(entry)
    }
  }

  return res
}
Find heads from a collection of entries.

Finds entries that are the heads of this collection,
ie. entries that are not referenced by other entries.

This function is private and not exposed in the Log API

@param {Array<Entry>} entries Entries to search heads from
@return {Array<Entry>}
@private