
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@prygun/currency-converter
Advanced tools
A module for converting currency using the OpenExchangeRates API.
This is a module for converting currency using the OpenExchangeRates API. It provides a simple interface for converting between various currencies based on current exchange rates.
To install this module, run the following command:
npm install @prygun/currency-converter
Before using the CurrencyConverter class, you need to obtain an App ID from OpenExchangeRates. To get an App ID, follow these steps:
To use the CurrencyConverter class, import it and create a new instance with your OpenExchangeRates App ID as the constructor parameter:
import { CurrencyConverter } from '@prygun/currency-converter';
const converter = new CurrencyConverter('YOUR_OPEN_EXCHANGE_RATES_APP_ID');
Then, call the convert method with the desired parameters:
const convertedAmount = await converter.convert('USD', 'EUR', 10);
console.log(convertedAmount); // 9.41
By default, the convert method rounds the converted amount to 2 decimal places. You can override this by passing a fourth parameter to the method:
const convertedAmount = await converter.convert('USD', 'EUR', 10, 4);
console.log(convertedAmount); // 9.4081
The convert
method accepts four parameters:
fromCurrency
- The currency code to convert from.toCurrency
- The currency code to convert to.amount
- The amount to convert.round
(optional) - The number of decimal places to round the converted amount to. Defaults to 2
if not specified.This module is licensed under the ISC License. See the LICENSE file for details.
This module was developed with the support of ChatGPT, an AI language model created by OpenAI.
FAQs
A module for converting currency using the OpenExchangeRates API.
The npm package @prygun/currency-converter receives a total of 39 weekly downloads. As such, @prygun/currency-converter popularity was classified as not popular.
We found that @prygun/currency-converter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.