Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
currency-formatters
Advanced tools
Empower your applications with our comprehensive currency formatter npm package. Seamlessly handle currency and number formatting with ease, whether you're dealing with monetary values or numeric representations. Our versatile library supports a wide rang
currency-formatter
is a TypeScript and React utility package for formatting numbers as currencies using various numbering systems (Indian, US, European) with appropriate currency symbols.
To install the package, run:
npm install currency-formatters
Here's how to use currency-formatters
in a React application:
// src/App.tsx
import React from 'react';
import { useCurrencyFormatter } from 'currency-formatter'; // Import the hook from the package
const App: React.FC = () => {
const formatINR = useCurrencyFormatter({
numberingSystem: 'indian',
currency: '₹'
});
const formatUSD = useCurrencyFormatter({
numberingSystem: 'us',
currency: '$'
});
const formatEUR = useCurrencyFormatter({
numberingSystem: 'european',
currency: '€'
});
return (
<div style={{ padding: '20px', fontFamily: 'Arial, sans-serif' }}>
<h1 style={{ color: '#4CAF50' }}>Currency Formatter Example</h1>
<p><strong>INR:</strong> {formatINR(100000)}</p>
<p><strong>USD:</strong> {formatUSD(100000)}</p>
<p><strong>EUR:</strong> {formatEUR(100000)}</p>
</div>
);
};
export default App;
useCurrencyFormatter
A custom React hook that formats a number as a currency string based on the specified numbering system and currency symbol.
Parameters
numberingSystem: string
- The numbering system to use. Possible values are 'indian'
, 'us'
, and 'european'
.
currency: string
- The currency symbol to use.
Example
const formatINR = useCurrencyFormatter({
numberingSystem: 'indian',
currency: '₹'
});
console.log(formatINR(100000)); // Outputs: ₹1L
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Empower your applications with our comprehensive currency formatter npm package. Seamlessly handle currency and number formatting with ease, whether you're dealing with monetary values or numeric representations. Our versatile library supports a wide rang
The npm package currency-formatters receives a total of 3 weekly downloads. As such, currency-formatters popularity was classified as not popular.
We found that currency-formatters demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.