Pular para o conteúdo
Kitbay
Skill

Format numbers

MITAtualizado em 11 de nov. de 202655.770Estrelas no GitHub

A short contributor skill in the Ghost repository that applies whenever a TSX file is edited.

O que a skill ensina

A short contributor skill in the Ghost repository that applies whenever a TSX file is edited. Every number shown to users must go through the formatNumber helper from Ghost's Shade design-system utilities: member, visitor and subscriber counts, email opens, clicks and bounces, post views and link clicks, and revenue after converting cents to dollars. Percentages such as open rates use a separate percentage helper, and compact forms like 1.2M use an abbreviation helper. The skill lists what to avoid: calling toLocaleString directly, building a number formatter by hand, showing raw numbers, or inserting thousands separators with a regular expression.

O que faz

  • Format displayed numbers with Shade's helper
  • Convert revenue from cents before formatting
  • Use percentage and abbreviation helpers
  • Avoid ad hoc number formatting