app/lib/publications/authors.mjs
14 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| canonicalAuthor | 14 to 17 | 2 | 100% | OkCRAP 2 | No data: no mutants in this code |
Imports
It imports app/lib/publications/entities.mjs. Imported by app/lib/cv/entries.mjs, app/lib/cv/validate.mjs, app/lib/publications/exports.mjs, app/lib/publications/sources.server.ts, app/lib/seo.ts.
Source
// The alias table is explicit: a surname-plus-initial rule would fold Julie Edwards, a different
// person in the data, into the owner. Its own module so `seo.ts` can reach it without the exports'
// organism table. Must stay loadable by node:test.
import { decodeEntities } from "./entities.mjs";
// Exact spellings seen in the corpus, never patterns.
const AUTHOR_ALIASES = new Map([
["Dustin C. Edwards", "Dustin Edwards"],
["Dustin Cole Edwards", "Dustin Edwards"],
]);
/** @param {string} name */
export function canonicalAuthor(name) {
const clean = decodeEntities(name).replace(/\s+/g, " ").trim();
return AUTHOR_ALIASES.get(clean) ?? clean;
}