
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
financial-utils
Advanced tools
A lightweight Node.js utility library for common financial operations like currency formatting, tax calculation, currency conversion, and loan EMI computation.
A lightweight and easy-to-use Node.js module that provides practical financial utility functions including:
To install the module via npm, run the following command in your terminal:
npm install financial-utils
Once installed, you can use the module in your Node.js project as shown below:
const {
formatCurrency,
calculateTax,
convertCurrency,
calculateEMI,
} = require('financial-utils');
// Format currency
console.log(formatCurrency(1234.56)); // $1,234.56
console.log(formatCurrency(1234.56, 'EUR', 'de-DE')); // 1.234,56 €
// Calculate tax
console.log(calculateTax(1000, 0.2)); // 200.00
// Convert currency (mock rate)
console.log(convertCurrency(100, 1.13)); // 113.00
// Calculate EMI
console.log(calculateEMI(10000, 7.5, 12)); // 865.27
formatCurrency(amount, currency = 'USD', locale = 'en-US')
Formats a number into a localized currency string.
number: The amount to format.string (optional): The ISO 4217 currency code (e.g., USD, EUR). Defaults to 'USD'.string (optional): The BCP 47 language tag for localization (e.g., en-US, de-DE). Defaults to 'en-US'.formatCurrency(1234.56); // $1,234.56
formatCurrency(1234.56, 'EUR', 'de-DE'); // 1.234,56 €
calculateTax(amount, rate)
Calculates tax based on a percentage rate.
number: The amount on which tax will be calculated.number: The tax rate as a decimal (e.g., 0.2 for 20%).calculateTax(1000, 0.2); // 200.00
calculateEMI(principal, annualRate, months)
Calculates the Equated Monthly Installment (EMI) for a loan.
number: The loan amount.number: The annual interest rate as a percentage (e.g., 7.5 for 7.5%).number: The loan duration in months.calculateEMI(10000, 7.5, 12); // 865.27
This module can be used in various financial applications, including:
The project follows a modular structure with separate files for each financial utility function:
financial-utils/
├── index.js # Main entry point
├── currency.js # Currency-related functions (e.g., formatCurrency, convertCurrency)
├── tax.js # Tax-related function (e.g., calculateTax)
├── loan.js # Loan-related function (e.g., calculateEMI)
├── test.js # Test script for demonstration
└── package.json # Project metadata and dependencies
This module is licensed under the MIT License.
FAQs
A lightweight Node.js utility library for common financial operations like currency formatting, tax calculation, currency conversion, and loan EMI computation.
The npm package financial-utils receives a total of 0 weekly downloads. As such, financial-utils popularity was classified as not popular.
We found that financial-utils 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.