@vandrei977/react-native-render-html
Version:
The hackable, full-featured Open Source HTML rendering solution for React Native.
16 lines (15 loc) • 396 B
text/typescript
export function getStringPrefixFromIndex(
index: number,
baseCharcode: number,
modulo: number
): string {
if (index < modulo) {
return String.fromCharCode(baseCharcode + index);
}
const rest = index % modulo;
const next = (index - rest - modulo) / modulo;
return (
getStringPrefixFromIndex(next, baseCharcode, modulo) +
String.fromCharCode(baseCharcode + rest)
);
}