oxr-to-linear-presets

1.0.4 • Public • Published

oxr-to-linear-presets

Build Status Coverage Status Code Climate

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));
  }
});

Package Sidebar

Install

npm i oxr-to-linear-presets

Weekly Downloads

1

Version

1.0.4

License

MIT

Last publish

Collaborators

  • javiercejudo