scurker / currency.js

A javascript library for handling currencies

Home Page:https://currency.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way to set precision to all amounts?

AlbertoJALJ opened this issue · comments

@AlbertoJALJ in a global way? Nop.

It's easy tho, just create your own re-useable solution

import currencyJs from "currency.js";

const currency = (
  value: string | number | currencyJs,
  opts?: currencyJs.Options | undefined
) => currencyJs(value, { ...opts, precision: opts?.precision || 0.2, });