The string containing numbers to convert to superscripts
The string with numbers converted to superscript characters
superscript("10^2") // Returns "10²"
superscript("2^3") // Returns "2³"
export const superscript = (str: string) => {
return str.replace(/[0-9]/g, (match) => SUPERSCRIPTS[match]);
};
Converts regular numbers in a string to superscript Unicode characters.