Menu

A test in our pricing package fails if any price sentence says approximately, and the banned words include the name of our own currency
📰

A test in our pricing package fails if any price sentence says approximately, and the banned words include the name of our own currency

DEV Community: typescript·Daniel Pertu·4 days ago
#7pJlzcKq
#devtotypescript#devto#dev#pricing#price
Reading 0:00
15s threshold

Munchable is priced at £10 a month. Open munchable.app/#pricing from a German IP and it says €12.99, from an American one $14.99, from a Japanese one ¥2,300. Twenty-four currencies, 58 countries mapped into them, everything else falling back to pounds.

None of those figures is a conversion performed at page load. Each one is a fixed price that was set once, from a rate on a date, and then written into a table:

export const CURRENCIES = { gbp : { code : 'GBP' , locale : 'en-GB' , rate : 1 } , eur : { code : 'EUR' , locale : 'en-IE' , rate : 1.1696 } , jpy : { code : 'JPY' , locale : 'ja-JP' , rate : 215.89 } , // ...21 more } as const satisfies Record < string , CurrencyDefinition > ;

Enter fullscreen mode

Exit fullscreen mode

with this above the rate field:

Hardcoded on purpose: the rate is how the price was chosen, not something the price follows.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.