@k8ts/instruments
Version:
A collection of utilities and core components for k8ts.
20 lines • 557 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSuperScript = toSuperScript;
const digits = ["⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹"];
function toSuperScript(n) {
if (n < 0) {
return "⁻" + toSuperScript(-n);
}
const num = [];
while (n >= 0) {
const digit = n % 10;
n = Math.floor(n / 10);
num.unshift(digits[digit]);
if (n === 0) {
break;
}
}
return num.join("");
}
//# sourceMappingURL=super-script.js.map