import { length } from "https://deno.land/x/libauth@v2.0.0-alpha.9/src/lib/format/utf8.ts";
Return the user-perceived character length of the given string, e.g.:
const test = 'ο¬tππ«π¨βπ©βπ§βπ¦'
console.log(test.length); // 17
console.log(length(test)); // 5
Note, this utility segments the string into grapheme clusters using
Intl.Segmenter
, a TC39 proposal which reached stage 4 in 2022, and may not
be supported in older environments.