Skip to content

to baseline

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Convert string to baseline characters, limited support.

Only the following characters can be baselined:

  • ⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₔᵝᵞᵟᶿᶥᵠᵡᵦᵧᵨᵩᵪ
  • ᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂᶦᶫᶰᶸᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓ
const toBaseLine = require('@extra-string/to-baseline');
// toBaseLine(<string>, [superseparator], [subseparator])

toBaseLine('ax²+bx+c');
// 'ax2+bx+c'
toBaseLine('H₂SO₄ beaker');
// 'H2SO4 beaker'
toBaseLine('6.626 x 10⁻³⁴', ['^']);
// '6.626 x 10^-34'
toBaseLine('1010₂', null, [' (base-', ')']);
// '1010 (base-2)'

extra-string

Clone this wiki locally