15 lines
448 B
TypeScript
15 lines
448 B
TypeScript
const ZERO_WIDTH_CHARACTERS = /[\u200B-\u200D\uFEFF]/g;
|
|
|
|
export function normalizeRiotIdPart(value: string): string {
|
|
return value.replace(ZERO_WIDTH_CHARACTERS, '').trim().normalize('NFC');
|
|
}
|
|
|
|
export function formatCodePoints(value: string): string {
|
|
return Array.from(value)
|
|
.map((char) => {
|
|
const codePoint = char.codePointAt(0);
|
|
return `U+${codePoint?.toString(16).toUpperCase().padStart(4, '0')}`;
|
|
})
|
|
.join(' ');
|
|
}
|