From 7fe9315eb3988ba20db9b2e60eac2d9139f99f2a Mon Sep 17 00:00:00 2001 From: pantonshire Date: Thu, 15 Jun 2023 11:42:19 +0100 Subject: [PATCH] decomp and case mappings --- src/components/output_table.tsx | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/output_table.tsx b/src/components/output_table.tsx index c32986e..6f162ff 100644 --- a/src/components/output_table.tsx +++ b/src/components/output_table.tsx @@ -48,7 +48,12 @@ export function OutputTable(props: { currentString: string }) { {charData.category_full()} {combiningClassName || combiningClassNum} {charData.bidi_full()} - {charData.numeric_value() || 'Not numeric'} + {charData.mirrored() ? 'Yes' : 'No'} + {optCharCodes(charData.decomp_string())} + {optCharCodes(charData.uppercase_string())} + {optCharCodes(charData.lowercase_string())} + {optCharCodes(charData.titlecase_string())} + {charData.numeric_value()} )); @@ -76,7 +81,12 @@ export function OutputTable(props: { currentString: string }) { Category Combining Bidirectional - Numeric value + Mirrored + Decomp + Upper + Lower + Title + Numeric @@ -98,3 +108,20 @@ function codepointToString(codepoint: EncodedCodepoint): string { return bytes.map((b) => b.toString(16).padStart(2, '0')).join(' '); } + +function charCodes(s: string): string { + let codes = []; + for (const codepointStr of s) { + const codepoint = codepointStr.codePointAt(0); + codes.push('U+' + codepoint?.toString(16).padStart(4, '0')); + } + + return codes.join(', '); +} + +function optCharCodes(s: string | undefined): string | undefined { + if (s !== undefined) { + return charCodes(s); + } + return undefined; +}