@nestlab/byn-exchange
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

BYN exchange module

Module for get currency exchange rates. Provider national bank of Belarus.

Install

$ npm i @nestlab/byn-exchange

Configuration

@Module({
    imports: [
        BynExchangeModule.forRoot({
            useCache: true,
            cacheTtl: 24 * 3600 * 1000, // 1 day
        })
    ],
})
export class AppModule {
}

Usage

export class YourService {
    constructor(private readonly converter: BynExchangeConverter) {
    }
    
    async convert1000UsdToByn(): Promise<number> {
        this.converter.convert(Currency.USD).toByn(1000);
    }

    async convert1000BynToUsd(): Promise<number> {
        this.converter.convert(Currency.USD).fromByn(1000);
    }
}

Enjoy!

Package Sidebar

Install

npm i @nestlab/byn-exchange

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

23.4 kB

Total Files

4

Last publish

Collaborators

  • chvarkov