npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

intl-number-parser

v1.0.3

Published

Utility for parsing international numbers to native JavaScript numbers based on the locale

Downloads

2,347

Readme

Intl-Number-Parser 🔢

🔢 A JavaScript function that parses numbers in various international number systems (locale) to native JavaScript numbers.

📖 Introduction

Intl-Number-Parser is a lightweight and easy-to-use JavaScript function that allows you to parse numbers in different international number systems to native JavaScript numbers. It uses the built-in Intl object to format and parse numbers based on the locale specified.

The function provides support for different number systems and supports different formats for negative numbers and currencies. Internally, the function uses Intl.NumberFormat. Currently, it assumes positional and decimal numerals.

🚀 Usage

To use the Intl-Number-Parser function, simply import it into your project and call it with a string containing the number you want to parse. You can also specify a locale and options for the Intl.NumberFormat constructor, which the function uses internally to format and parse numbers.

Here's an example of how to use the function:

import NumberParser from 'intl-number-parser';

const parser = NumberParser('en-US', { style: 'currency', currency: 'USD' });

const number = parser('$1,234.56'); // returns 1234.56

In this example, we create a new instance of the Intl-Number-Parser function with the en-US locale and the currency style, which formats the number as a currency with the USD currency code. We then call the function with a string containing a currency-formatted number and get back the parsed JavaScript number.

🤝 Contributing

Contributions to the Intl-Number-Parser project are welcome and encouraged! If you find a bug or have an idea for a new feature, please open an issue on the project's GitHub page.

If you want to contribute code, please fork the repository and submit a pull request. Please make sure to write tests for any new code and ensure that all existing tests pass before submitting your pull request.

📜 License

Intl-Number-Parser is free software licensed under the ISC License. Feel free to use it in your own projects or modify it as needed.