oxr-to-linear-presets
v1.0.4
Published
Transform open exchange rates API response to linear presets format
Downloads
3
Maintainers
Readme
oxr-to-linear-presets
Transform open exchange rates API response to linear presets format.
Install
npm i oxr-to-linear-presets
Usage
See the tested example or check the live Tonic notebook.
It also works with fixer.io out of the box (live example).
Node.js
var oxrTransform = require('oxr-to-linear-presets');
var oxr = require('open-exchange-rates');
oxr.set({ app_id: 'YOUR_APP_ID' });
oxr.latest(function() {
console.log(oxrTransform(oxr.rates, oxr.base));
});
jQuery
// browserified or similar
var oxrTransform = require('oxr-to-linear-presets');
$.ajax({
url: 'https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID',
dataType: 'jsonp',
success: function(json) {
console.log(oxrTransform(json.rates, json.base));
}
});