🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

numeral

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numeral

Format and manipulate numbers.

2.0.6
latest
Source
npm
Version published
Weekly downloads
1.5M
1.62%
Maintainers
1
Weekly downloads
 
Created

What is numeral?

The numeral npm package is a library for formatting and manipulating numbers. It allows users to perform number formatting, including currency, percentages, and time; convert between different units; and manipulate numbers with mathematical operations.

What are numeral's main functionalities?

Number Formatting

This feature allows users to format numbers with commas as thousands separators, which is useful for displaying large numbers in a more readable format.

"const numeral = require('numeral');\nlet number = numeral(1000);\nlet formatted = number.format('0,0');\nconsole.log(formatted); // '1,000'"

Currency Formatting

Currency formatting feature enables users to format numbers as currency, including the addition of currency symbols and control over decimal places, making it easier to display monetary values.

"const numeral = require('numeral');\nlet money = numeral(1000.234);\nlet formatted = money.format('$0,0.00');\nconsole.log(formatted); // '$1,000.23'"

Percentage Formatting

This feature allows for the formatting of numbers as percentages, including rounding and specifying the number of decimal places, useful for displaying ratios or proportions.

"const numeral = require('numeral');\nlet percent = numeral(0.974878234);\nlet formatted = percent.format('0.00%');\nconsole.log(formatted); // '97.49%'"

Other packages similar to numeral

Keywords

numeral

FAQs

Package last updated on 27 Mar 2017

Did you know?

Socket

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.

Install

Related posts