Socket
Socket
Sign inDemoInstall

amount

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amount

Amount and currency formatter


Version published
Weekly downloads
27
increased by170%
Maintainers
1
Weekly downloads
 
Created
Source

amount

Amount and currency formatter

npm Build Status GitHub license

node

npm i amount --save

yarn

yarn add amount

Usage

// amount(amount, decimals_separator, thousands_separator, decimal_digits)

amount(87686.987);
// '87686.987'

// setting decimals separator

amount(87686.987, ',');
// '87686,987'

// setting thousands separator

amount(87686.987, ',', '.');
// '87.686,987'

// setting number of decimals

amount(87686.987, ',', '.', 2);
// '87.686,98'

amount(87686.987, ',', '.', 1);
// '87.686,9'

amount(87686, ',', '.', 2);
// '87.686,00'

currency


amount.currency(87686.987, 'EUR');
// '87 686,98 €'

amount.currency(87686.987, 'USD');
// '$87,686.98'

amount.currency(87686.987, {
  thousands_separator: ',',
  decimals_separator: '.',
  decimal_digits: 2,
  symbol: '€',
  symbol_on_left: false,
  symbol_space: ' ',
});
// '87.686,98 €'

Keywords

FAQs

Package last updated on 07 Jun 2018

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc