casha
v2.1.0
Published
Convert between currencies.
Downloads
9
Maintainers
Readme
Casha
Convert between currencies.
Install
npm install casha
Usage
const casha = require("casha");
(async () => {
await casha(10, "nzd", "usd");
//=> 6.6
})()
API
casha(amount, from, to, options?)
amount
Type: number
The amount to convert.
from
Type: number
The currency to convert from.
to
Type: number
The currency to convert to.
options
Type: object
date
Type: string | number | Date | instanceof dayjs
Default: latest
The date to get the currency conversion information for.
precision
Type: number
Default: 2
The precision to round the number to.
provider
Type: string
(exchangeratesapi
, fixer
, currencylayer
or openexchangerates
)
Default: exchangeratesapi
The conversion rate provider to use.
apiKey
Type: string
The key/token/id to pass to the API (if any).
Migrating from v1
- Node.js 10 or later is required.