Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@sumup/intl
Advanced tools
Format numbers, currency values, dates, and times for any locale with the ECMAScript Internationalization API
Format 🔢 numbers, 💱 currency values, 📅 dates, and 🕘 times for any locale with the ECMAScript Internationalization API.
@sumup/intl
is a light abstraction layer on top of the ECMAScript Internationalization API. In addition to a simplified API, it offers the following benefits:
Creating instances of Intl.*
formatters is an expensive operation. @sumup/intl
solves this by memoizing the Intl
formatters with a cache key based on the arguments passed to the constructor.
@sumup/intl
works in modern browsers as well as server runtimes with support for the Intl
APIs (such as Node 10+1). When the Intl
APIs aren't (fully) available, @sumup/intl
tries to gracefully degrade. Please refer to the API reference to learn how certain functions behave when the runtime doesn't support the necessary APIs. If you need to support legacy browsers, consider including polyfills.
@sumup/intl
can be installed as a dependency via the npm or Yarn package managers. Depending on your preference, run one of the following:
# With npm
npm install @sumup/intl
# With Yarn v1
yarn add @sumup/intl
@sumup/intl
requires Node v10+.
The functions exported by @sumup/intl
share a similar interface such as the common locales
, options
, and currency
arguments. These are passed on almost unchanged to the Intl.*
constructors and thus support the same values. If the locales
argument is not provided or is undefined, the runtime's default locale is used. Please refer to the MDN documentation for more details.
Each type of data can be formatted with three increasingly advanced functions:
format*
functions return the formatted value as a string and cover the most common use cases.format*ToParts
functions return an array of objects representing the value in parts that can be used for custom locale-aware formatting. For example, part of the formatted value could be rendered in bold.resolve*Format
functions return an object with properties reflecting the locale and collation options computed during initialization of the object. These options can be passed to other functions or libraries to format values, for example react-number-format
.We want to foster an inclusive and friendly community around our Open Source efforts. Like all SumUp Open Source projects, this project follows the Contributor Covenant Code of Conduct. Please, read it and follow it.
If you feel another member of the community violated our CoC or you are experiencing problems participating in our community because of another individual's behavior, please get in touch with our maintainers. We will enforce the CoC.
SumUp is a mobile point-of-sale provider. It is our mission to make easy and fast card payments a reality across the entire world. You can pay with SumUp in more than 30 countries, already. Our engineers work in Berlin, Cologne, Sofia, and Sāo Paulo. They write code in TypeScript, Swift, Ruby, Go, Java, Erlang, Elixir, and more.
Want to come work with us? Head to our careers page to find out more.
Node supports the Intl
APIs since v8, however, it includes only the English localizations up to v12. Node v13 and above support all locales. If you're unable to use Node v13+, you can either include polyfills or use a custom Node build. ↩
1.6.0
fe8e8dc
Thanks @connor-baer! - Added exceptions for the COP and HUF currencies to be formatted without decimals. While these currencies support decimals under the ISO standard, the decimals are not used in everyday life.FAQs
Format numbers, currency values, dates, and times for any locale with the ECMAScript Internationalization API
The npm package @sumup/intl receives a total of 2,622 weekly downloads. As such, @sumup/intl popularity was classified as popular.
We found that @sumup/intl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 17 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.