casha
TypeScript icon, indicating that this package has built-in type declarations

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.

Package Sidebar

Install

npm i casha

Weekly Downloads

6

Version

2.1.0

License

MIT

Unpacked Size

7.62 kB

Total Files

6

Last publish

Collaborators

  • richienb