Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.