diff options
Diffstat (limited to 'src/lib/strings/bidi.ts')
-rw-r--r-- | src/lib/strings/bidi.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/strings/bidi.ts b/src/lib/strings/bidi.ts new file mode 100644 index 000000000..790c2b6ac --- /dev/null +++ b/src/lib/strings/bidi.ts @@ -0,0 +1,10 @@ +const LEFT_TO_RIGHT_EMBEDDING = '\u202A' +const POP_DIRECTIONAL_FORMATTING = '\u202C' + +/* + * Force LTR directionality in a string. + * https://www.unicode.org/reports/tr9/#Directional_Formatting_Characters + */ +export function forceLTR(str: string) { + return LEFT_TO_RIGHT_EMBEDDING + str + POP_DIRECTIONAL_FORMATTING +} |