{"repo":"markmead/alpinejs-money","free":true,"listed":false,"github":"https://github.com/markmead/alpinejs-money","clone":"git clone https://github.com/markmead/alpinejs-money.git","description":"Format money through Alpine JS into any language and currency (works with Shopify settings) 💸","language":"JavaScript","stars":40,"topics":["alpinejs","shopify","currency","ecommerce","formatting","frontend","i18n","javascript","money-format","utilities"],"license":"MIT","category":"ecommerce","readme_excerpt":"Alpine JS Money Alpine JS plugin for formatting currency values in multiple languages and currencies 💸 Install With a CDN With a Package Manager Example Basic Minor Units By default the value is treated as minor units and divided by the number of decimal places the currency actually has, which Intl knows per currency. Use the .decimal modifier when the value is already a major-unit decimal and should not be divided at all. With Data Attributes With Global This will look for locale and currency which is on the global xMoney object. With Shopify This will look for Shopify.locale and Shopify.currency.active which is on the global Shopify object. Most themes set this for you. If yours doesn't, set it yourself. With Flat Modifier The .flat modifier drops the decimal part when the value is a whole number, and leaves it alone otherwise. It works for currencies with any number of decimal places, so BHD 60.000 flattens to BHD 60 too. When Nothing Renders The element is left untouched, rather than erroring or showing a placeholder, when any of these are true. - The locale or currency can't be resolved. With .shopify or .global this usually means the global object isn't on the page yet. - The value is null , undefined or an empty string. Note that 0 does render, as £0.00 . - The value isn't a finite number, so \"abc\" renders nothing rather than £NaN . Upgrading from v1 Minor units are per currency v1 always divided by 100. v2 divides by the number of decimal places the currency actually","default_branch":null,"files":null,"tree":[],"storefront":"/r/markmead","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/markmead/alpinejs-money/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}