Bluesky app fork with some witchin' additions 💫

forgot this file!!

authored by

12Me21 and committed by ansxor.ca 040314ea d2a16fd2

+13
+13
src/lib/twelve/byteindex.js
··· 1 + function string_to_bytes(string) { 2 + return unescape(encodeURIComponent(string)) 3 + } 4 + function bytes_to_string(string) { 5 + return decodeURIComponent(escape(string)) 6 + } 7 + // note: we always work with native strings in our code 8 + export function index_to_byteindex(string, index) { 9 + return string_to_bytes(string.slice(0, index)).length 10 + } 11 + export function byteindex_to_index(string, byteindex) { 12 + return bytes_to_string(string_to_bytes(string).slice(0, byteindex)).length 13 + }