stripe-money-format

1.0.10 • Public • Published

Stripe Money format

A simple js utility to format numbers to Stripe's smallest common currency unit format

Supports most International Curriences.

Usage

ES6

import StripeMoneyFormat from "stripe-money-format";

const number = 86753.09;
console.log(StripeMoneyFormat.toStripeFormat(number)); // 8675309

CommonJS

const {toStripeFormat} = require("stripe-money-format");

const number = 86753.09;
console.log(toStripeFormat(number)); // 8675309

International Currency Support

Should support any currency available to the node Intl package: Intl.NumberFormat

ES6 Example

import StripeMoneyFormat from "stripe-money-format";

const number = 123456.789;
const currency = "EUR";
const language = "de-DE";

console.log(toStripeFormatCustomCurrency(currency, language, number)); // 12345679

Common JS Example

const {toStripeCustomCurrency} = require("stripe-money-format");

const number = 123456.789;
const currency = "EUR";
const language = "de-DE";

console.log(toStripeCustomCurrency(currency, language, number)); // 12345679

Readme

Keywords

Package Sidebar

Install

npm i stripe-money-format

Weekly Downloads

2

Version

1.0.10

License

ISC

Unpacked Size

18 kB

Total Files

12

Last publish

Collaborators

  • titani0us