Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

casha

2.1.0 • Public • Published

Casha Travis CI Build Status

Convert between currencies.

NPM Badge

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.

Install

npm i casha

DownloadsWeekly Downloads

3

Version

2.1.0

License

MIT

Unpacked Size

7.62 kB

Total Files

6

Last publish

Collaborators

  • avatar