Socket
Book a DemoInstallSign in
Socket

accounting

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accounting

number, money and currency formatting library

0.4.1
latest
Source
npmnpm
Version published
Weekly downloads
221K
-2.8%
Maintainers
1
Weekly downloads
 
Created

What is accounting?

The accounting npm package is a lightweight JavaScript library for number, money, and currency formatting. It provides simple and easy-to-use methods for formatting numbers, currencies, and handling various financial calculations.

What are accounting's main functionalities?

Number Formatting

This feature allows you to format numbers with thousand separators and decimal points. The formatNumber method takes a number and returns it as a string formatted with commas as thousand separators.

const accounting = require('accounting');
const formattedNumber = accounting.formatNumber(1234567.89);
console.log(formattedNumber); // '1,234,567.89'

Currency Formatting

This feature allows you to format numbers as currency. The formatMoney method takes a number and returns it as a string formatted as currency, including the currency symbol and proper decimal places.

const accounting = require('accounting');
const formattedCurrency = accounting.formatMoney(1234567.89);
console.log(formattedCurrency); // '$1,234,567.89'

Unformatting Numbers

This feature allows you to convert formatted numbers or currency strings back into plain numbers. The unformat method takes a formatted string and returns it as a number.

const accounting = require('accounting');
const number = accounting.unformat('$1,234,567.89');
console.log(number); // 1234567.89

Other packages similar to accounting

Keywords

accounting

FAQs

Package last updated on 16 Jul 2014

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.