UNPKG

oip-exchange-rate

Version:

Get the Exchange Rate for many cryptocurrencies

38 lines (27 loc) 1.45 kB
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var DEFAULT_TRANSFORM_FUNCTION = function DEFAULT_TRANSFORM_FUNCTION(response) { return response; }; module.exports = function () { function URLExplorer(url) { _classCallCheck(this, URLExplorer); this.url = url; } _createClass(URLExplorer, [{ key: 'getExchangeRate', value: function getExchangeRate() { var _this = this; return new Promise(function (resolve, reject) { _axios2.default.get(_this.url).then(function (response) { resolve(response.data); }); }); } }]); return URLExplorer; }();