Social data

Choose a username-normalization policy explicitly

Decide which username representations count as the same identifier before comparing exports. The current checker uses extracted username strings as Map keys and does not perform the normalization shown in this separate demonstration.

Worked example

Node.js example · save as example.mjs and run node example.mjs

function comparisonKey(name) {
  return name.trim().replace(/^@/, "").toLowerCase();
}
const raw = [" River ", "@river", "RIVER"];
console.log(JSON.stringify([...new Set(raw.map(comparisonKey))]));

How it works

The sample policy trims edges, removes one leading at-sign, and lowercases. It can help when combining manually prepared lists whose display conventions differ. Preserving the original display value separately makes transformed comparisons easier to audit.

Limits and mistakes

Normalization must follow the identifier system’s actual rules. Do not apply it to case-sensitive IDs or assume it resolves renamed accounts. If the checker’s results disagree with a manually normalized report, the differing comparison policies may explain why.

Check the result

Expect ["river"]. Test identifiers with punctuation and non-ASCII characters relevant to the real source. Keep normalized keys and original values separate rather than rewriting the only copy of an export.

Sources

Reference documentation for the behavior used in this guide: