Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@internationalized/number
Advanced tools
Internationalized number formatting and parsing utilities
This package is part of react-spectrum. See the repo for more details.
The NumberParser
class can be used perform locale aware parsing of numbers from Unicode strings,
as well as validation of partial user input. It automatically detects the numbering system
used in the input, and supports parsing decimals, percentages, currency values, and units
according to the locale.
import {NumberParser} from '@internationalized/number';
let parser = new NumberParser('en-US', {style: 'percent'});
parser.parse('10%')); // -> 0.1
import {NumberParser} from '@internationalized/number';
let parser = new NumberParser('en-US', {style: 'unit', unit: 'inch'});
parser.isValidPartialNumber('10 i')); // -> true
parser.isValidPartialNumber('10 x')); // -> false
import {NumberParser} from '@internationalized/number';
let parser = new NumberParser('en-US', {style: 'decimal'});
parser.getNumberingSystem('١٢') // -> 'arab'
The NumberFormatter
class is a wrapper around Intl.NumberFormat providing additional options, polyfills, and caching for performance. It provides the exact same interface as Intl.NumberFormat, so it is a drop-in replacement. Please see the MDN docs linked above for more details.
We currently polyfill the following features:
signDisplay
optionunit
style, currently only for the degree
unit in the narrow
styleFAQs
Internationalized number formatting and parsing utilities
The npm package @internationalized/number receives a total of 1,054,964 weekly downloads. As such, @internationalized/number popularity was classified as popular.
We found that @internationalized/number demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.