reachesText

tcmts.registry.reachesText · #z4wcg7ne · term · runs anywhere

Where a release reaches outside itself, said plainly.

import { EFFECT_WORDS } from "#codebase/tcmts/cli/libraries";
import type { Effect } from "#codebase/tcmts/core/effects";

export function reachesText(r: { reaches: Map<Effect, string[]>; unknown: string[] }): string {
  const parts = (Object.keys(EFFECT_WORDS) as Effect[])
    .filter((e) => r.reaches.has(e))
    .map((e) => {
      const by = r.reaches.get(e)!;
      return `${EFFECT_WORDS[e]} (${by.slice(0, 3).join(", ")}${by.length > 3 ? `, and ${by.length - 3} more` : ""})`;
    });
  const said = parts.length ? `reaches ${parts.join(", ")}` : "reaches nothing outside itself";
  return r.unknown.length ? `${said}; can't tell for ${r.unknown.join(", ")}` : said;
}

uses

used by