function filterPrefixMatches(queryOutput, prefix) {
  const capitalize = prefix => `${prefix[0].toUpperCase()}${prefix.slice(1)}`;

  const filteredQueryOutput = queryOutput
    .map(e => {
      let keepVariable = false;
      let keepTag = false;
      if (e.variable) {
        const fromUnprefixed = e.variable.from.replace(capitalize(prefix.from), '');
        const toUnprefixed = e.variable.to.replace(capitalize(prefix.to), '');
        keepVariable = fromUnprefixed === toUnprefixed;
      }
      if (e.tag) {
        const fromUnprefixed = e.tag.from.replace(prefix.from, '');
        const toUnprefixed = e.tag.to.replace(prefix.to, '');
        keepTag = fromUnprefixed === toUnprefixed;
      }

      return {
        name: e.name,
        ...(keepVariable ? { variable: e.variable } : {}),
        ...(keepTag ? { tag: e.tag } : {}),
      };
    })
    .filter(e => e.tag || e.variable);

  return filteredQueryOutput;
}
For prefix `{ from: 'lion', to: 'wolf' }`

Keeps
- WolfCheckbox (extended from LionCheckbox)
- wolf-checkbox (extended from lion-checkbox)

Removes
- SheepCheckbox (extended from LionCheckbox)
- WolfTickButton (extended from LionCheckbox)
- sheep-checkbox (extended from lion-checkbox)
- etc...
@param {MatchPathsAnalyzerOutputFile[]} queryOutput
@param {{from:string, to:string}} prefix