MCPcopy
hub / github.com/graphql/graphql-spec / pickBetterName

Function pickBetterName

scripts/generate-contributor-list.mjs:23–32  ·  view source on GitHub ↗
(current, candidate)

Source from the content-addressed store, hash-verified

21 .toLowerCase();
22}
23function pickBetterName(current, candidate) {
24 if (!current) return (candidate || "").trim();
25 const c = current.trim();
26 const d = (candidate || "").trim();
27 if (!c && d) return d;
28 const spaceC = /\s/.test(c), spaceD = /\s/.test(d);
29 if (spaceD && !spaceC) return d;
30 if (d.length > c.length) return d;
31 return c;
32}
33function sanitizeDisplayName(raw, fallback) {
34 const s = (raw || "").trim();
35 if (!s) return fallback;

Callers 2

mainFunction · 0.85
workerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected