Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@types/numeral
Advanced tools
TypeScript definitions for numeral
@types/numeral provides TypeScript type definitions for the numeral.js library, which is used for formatting and manipulating numbers.
Number Formatting
This feature allows you to format numbers in various ways, such as adding commas as thousand separators.
const numeral = require('numeral');
const formattedNumber = numeral(1000).format('0,0');
console.log(formattedNumber); // Output: '1,000'
Currency Formatting
This feature allows you to format numbers as currency, including the appropriate currency symbol and decimal places.
const numeral = require('numeral');
const formattedCurrency = numeral(1000).format('$0,0.00');
console.log(formattedCurrency); // Output: '$1,000.00'
Percentage Formatting
This feature allows you to format numbers as percentages, including the percentage symbol and decimal places.
const numeral = require('numeral');
const formattedPercentage = numeral(0.25).format('0.00%');
console.log(formattedPercentage); // Output: '25.00%'
Unformatting
This feature allows you to convert formatted strings back into numbers.
const numeral = require('numeral');
const number = numeral().unformat('$1,000.00');
console.log(number); // Output: 1000
The accounting.js library provides similar functionality for number, money, and currency formatting. It is simpler and more lightweight compared to numeral.js, but it may lack some of the advanced features.
The currency.js library focuses specifically on currency formatting and manipulation. It offers a more modern API and better performance for currency-related tasks compared to numeral.js.
Dinero.js is a library for working with monetary values in JavaScript. It provides a more comprehensive and robust API for handling money, including arithmetic operations, formatting, and internationalization, making it more suitable for complex financial applications.
npm install --save @types/numeral
This package contains type definitions for numeral (https://github.com/adamwdraper/Numeral-js).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/numeral.
These definitions were written by Vincent Bortone, Kenneth Luján, Carlos Quiroga, and Piotr Błażejewicz.
FAQs
TypeScript definitions for numeral
The npm package @types/numeral receives a total of 481,563 weekly downloads. As such, @types/numeral popularity was classified as popular.
We found that @types/numeral demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.