Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
A module that enables fast and easy currency/ies conversion using the Yahoo Finance API.
npm install y-currency
Easy currency conversion using the yahoo api.
Version: 1.0.2
Author: Matas Kairaitis
License: MIT
function
function
Converts the provided values to another currency in one request.
Kind: static method of y-currency
Summary: When converting multiple values you should always pass them as an array instead of
calling this function multiple times. This way you minimize the amount of requests that are made.
Param | Type | Description |
---|---|---|
values | number | Array.<number> | A string or array of strings of the amounts to convert. |
from | string | The currency symbol to convert from. Will return an error if the symbol is not supported. |
to | string | The currency symbol to convert to. ill return an error if the symbol is not supported. |
cb | convertCallback | The calback that will be executed when the request is processed. |
Example
currency.convert(10, 'USD', 'EUR', function(err, converted) {
if (err) // Handle error
console.log(converted); // Outputs ~8.91 (the converted value)
});
Example
currency.convert([10, 20, 40], 'USD', 'EUR', function(err, converted) {
if (err) // Handle error
console.log(converted); // Outputs [9.11, 18.22, 27.33] (the converted values in an array)
});
Gets currency information as an object or array of objects in one request.
Kind: static method of y-currency
Param | Type | Description |
---|---|---|
symbols | string | Array.<string> | A string or array of strings of the pairs to get information on. |
cb | getCurrencyCallback | The calback that will be executed when the request is processed. |
Example
currency.getCurrency('USDEUR', function(err, result) {
if (err) // Handle error
console.log(result); // Outputs an object with currency information
// Output
{ id: 'USDEUR',
Name: 'USD to EUR',
Rate: '0.891',
Date: '2/27/2015',
Time: '10:56am',
Ask: '0.891',
Bid: '0.8909' }
});
Example
currency.getCurrency(['USDEUR', 'NZDCAD', 'THBSEK'], function(err, result) {
if (err) // Handle error
console.log(result); // Outputs an object array with currency information
// Output
[ { id: 'USDEUR',
Name: 'USD to EUR',
Rate: '0.8935',
Date: '2/27/2015',
Time: '12:07pm',
Ask: '0.8935',
Bid: '0.8935' },
{ id: 'NZDCAD',
Name: 'NZD to CAD',
Rate: '0.9452',
Date: '2/27/2015',
Time: '12:07pm',
Ask: '0.9455',
Bid: '0.9449' },
{ id: 'THBSEK',
Name: 'THB to SEK',
Rate: '0.2587',
Date: '2/27/2015',
Time: '12:07pm',
Ask: '0.2592',
Bid: '0.2581' } ]
});
function
Callback that handles the response by convert().
Kind: inner typedef of y-currency
Param | Type | Description |
---|---|---|
err | error | null | If an error occurs during the execution of the function it is passed here, otherwise null. |
values | number | Array.<number> | null | If no errors occured this contains the converted value/values, otherwise null. |
function
Callback that handles the response by getCurrency().
Kind: inner typedef of y-currency
Param | Type | Description |
---|---|---|
err | error | null | If an error occurs during the execution of the function it is passed here, otherwise null. |
values | Object | Array.<Object> | null | If no errors occured this contains the object or object array containing the currency information, otherwise null. |
FAQs
A module that enables fast and easy currency/ies conversion using the Yahoo Finance API.
We found that y-currency 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.