{"_id":"@abstractapi/javascript-exchange-rates","_rev":"1-eceac5bdec537d9d8cae2198c1471cb0","name":"@abstractapi/javascript-exchange-rates","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abstractapi/javascript-exchange-rates","version":"1.0.0","description":"AbstractAPI Javascript Exchange Rates Library - Wrapper to quickly start using the powerful AbstractAPI's Exchange Rates service in your projects.","main":"index.js","scripts":{"build":"webpack","build:lib":"npx babel src --out-dir lib","test":"jest --detectOpenHandles"},"repository":{"type":"git","url":"git+https://github.com/abstractapi/javascript-exchange-rates.git"},"keywords":["API","Abstract","Library","Wrapper","abstract","abstractapi","api","library","javascript-library","Currency","Currencies","Exchange rates","Currency exchange","wrapper"],"author":{"name":"Benjamin Bouchet","email":"libraries@abstractapi.com","url":"https://abstractapi.com/"},"license":"MIT","bugs":{"url":"https://github.com/abstractapi/javascript-exchange-rates/issues"},"homepage":"https://github.com/abstractapi/javascript-exchange-rates","devDependencies":{"@babel/cli":"^7.13.10","@babel/core":"^7.13.10","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-transform-async-to-generator":"^7.13.0","@babel/plugin-transform-modules-commonjs":"^7.13.8","@babel/preset-env":"^7.13.12","babel-loader":"^8.2.2","jest":"^26.6.3","regenerator-runtime":"^0.13.7","webpack":"^5.28.0","webpack-cli":"^4.5.0"},"dependencies":{"@abstractapi/javascript-core":"1.x","fsevents":"^2.3.2"},"directories":{"lib":"lib","test":"test"},"optionalDependencies":{"fsevents":"^2.3.2"},"gitHead":"f480a8b0dbdd7295c6273ed99587d2fa41279266","_id":"@abstractapi/javascript-exchange-rates@1.0.0","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-TGtP2PWlOVOaor0U3K/JzCaZ8nDCRSPBFm2B0NDI150KF9rFw75gvq4Npz5Tt3f96dJbXB3y61FuHJQChjs2LQ==","shasum":"c2088159055079a6232db0b24dd89594ff5cd039","tarball":"https://registry.npmjs.org/@abstractapi/javascript-exchange-rates/-/javascript-exchange-rates-1.0.0.tgz","fileCount":12,"unpackedSize":22855,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgsOUJCRA9TVsSAnZWagAAJYMQAIhMRStaky/Q7E6ZYgYv\nQeX4rh+MS//2x/+A0wASwskeq4S+AUFpn6rnSUShJiFQTMl+mVTF92Hoop7U\njeWVZrg1WtuW4nXswoR+Rl/w5mnACgoZjONX7azwrSOw/jAJbiMZ19yOKRNA\nqK3uVcFTc0AgUODg6MzHwPFzQSubg5qi7OMNYy5AAW8UaviMalwqv3HMzRQR\nskx+sx2tGbahVtk4yj6VSBBRfrv/L9Iuc+WSN7c8vEVNZ+U0/Xh4dfw3q+Yp\nAwUYh7DDQUutXqjIQxxajcFINt198cN9BAh2T+fnThGgWbz2bFOvi1onQig/\nCFKqRec+m+H42SOaCx1mFcRZ6sdSi7hMIe0FhTUN/kMKnVpgtFF8EelWUF9T\ndeGETVL2htwtd2LTouMstgB6JUC5N3X1fYoF4P9DDF1quGXth1mMV7YTyfLy\ne/P2H3zpwdw93RoB77Ee+JQQsDPKvG3vxUpijxJo8y2qQfKyaZegbbrzQYPw\n9q0j9ytO7d0fjupeQ/aeaPCN9jpT7OC/idk0960MO6nsp3q0yDD/jhA5j+1S\nP+FSfYLgf/LhafWzpYmi1u1E3MhZm82HTH3w1SBSHESw2YUg6RJLXqfhCZ4T\nkha/Mxr5JEHWSEvj7ChY0/Ozr/cV86btrfn6q6dZRwxz97Qf5c5U/31cFV4M\nQsyo\r\n=rsAx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFLk5YSa1S3T9aNCqI7A/CeaL2g5pIE03acqVitm9f68AiEAo10tnRKyRjCGkmCc0eTvIz9MC+/GibRc7Olmb0f08v4="}]},"_npmUser":{"name":"abstractteam","email":"libraries@abstractapi.com"},"maintainers":[{"name":"abstractteam","email":"libraries@abstractapi.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/javascript-exchange-rates_1.0.0_1622205704906_0.9321664526598992"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-28T12:41:44.542Z","1.0.0":"2021-05-28T12:41:45.007Z","modified":"2022-04-04T11:02:26.217Z"},"maintainers":[{"name":"abstractteam","email":"libraries@abstractapi.com"}],"description":"AbstractAPI Javascript Exchange Rates Library - Wrapper to quickly start using the powerful AbstractAPI's Exchange Rates service in your projects.","homepage":"https://github.com/abstractapi/javascript-exchange-rates","keywords":["API","Abstract","Library","Wrapper","abstract","abstractapi","api","library","javascript-library","Currency","Currencies","Exchange rates","Currency exchange","wrapper"],"repository":{"type":"git","url":"git+https://github.com/abstractapi/javascript-exchange-rates.git"},"author":{"name":"Benjamin Bouchet","email":"libraries@abstractapi.com","url":"https://abstractapi.com/"},"bugs":{"url":"https://github.com/abstractapi/javascript-exchange-rates/issues"},"license":"MIT","readme":"# AbstractAPI javascript-exchange-rates library\n\nIntegrate the powerful [Exchange Rates API from Abstract](https://www.abstractapi.com/exchange-rate-api) in your Javascript or NodeJS project in a few lines of code.\n\nThe Exchange Rate API is an REST API that allows you to:\n\n- look up the latest exchange rates for 80+ currencies via the *live* endpoint\n- get historical exchange rates using the *historical* endpoint\n- convert an arbitrary amount from one currency to another using the *convert* endpoint\n\nIt's very simple to use: you only need to submit your API key and a currency symbole (such as \"USD\"), and the API will respond with current exchange rate, historical data, or convertion rates.\n\n# Documentation\n\n## Installation\n\nYou can install **javascript-exchange-rates** via npm, from our CDN, or download the source into your project.\n\n### ES6\n\nDownload and install the library from npm:\n\n```\nnpm install @abstractapi/javascript-exchange-rates --save\n```\n\nIn your project, import it and configure your `API_KEY`:\n\n```js\nimport {AbstractExchangeRates} from 'javascript-exchange-rates'\n\nAbstractExchangeRates.configure('API_KEY')\n```\n\n### Browser, from the CDN\n\nYou can have the browser download the library from its closest location through jsDeliver CDN:\n\n```js\n<script src=\"https://cdn.jsdelivr.net/npm/@abstractapi/javascript-core@latest/dist/javascript-core.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/@abstractapi/javascript-exchange-rates@latest/dist/javascript-exchange-rates.js\"></script>\n<script>\n    AbstractExchangeRates.configure('API_KEY');\n\n    // use the library\n</script>\n```\n\n### Browser, from the built file\n\nYou can build the library yourself, or get the already built file from the `dist` directory and load it:\n\n```js\n<script src=\"dist/javascript-exchange-rates.js\"></script>\n<script>\n    AbstractExchangeRates.configure('API_KEY');\n\n    // use the library\n</script>\n```\n\n## API key\n\nGet your API key for free and without hassle from the [Abstact website](https://app.abstractapi.com/users/signup?target=/api/exchange-rates/pricing/select).\n\n## Quickstart\n\nAbstractAPI **javascript-exchange-rates** library returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) so you can use one of the following approaches:\n\n### Async/Await\n\n```js\nasync function getLiveRates(currency) {\n  let response = await AbstractExchangeRates.live(currency);\n  console.log(response);\n}\n\nasync function getHistoricalRates(currency, date) {\n  let response = await AbstractExchangeRates.historical(currency, date);\n  console.log(response);\n}\n\nasync function getConvertion(currency, target) {\n  let response = await AbstractExchangeRates.convert(currency, target);\n  console.log(response);\n}\n```\n\n### Using .then()\n\n```js\nfunction getLiveRates(currency) {\n  AbstractExchangeRates.live(currency)\n    .then(response => {\n      console.log(response);\n    })\n}\n\nfunction getHistoricalRates(currency, date) {\n  AbstractExchangeRates.historical(currency, date)\n    .then(response => {\n      console.log(response);\n    })\n}\n\nfunction getConvertion(currency, target) {\n  AbstractExchangeRates.convert(currency, target)\n    .then(response => {\n      console.log(response);\n    })\n}\n```\n\n## API response\n\nThe API response contains the following fields:\n\n### `live` response parameters\n| Parameter| Type| Details |\n| - | - | - |\n| base | String | The base currency used to get the exchange rates. |\n| last_updated | String | The Unix timestamp of when the returned data was last updated. |\n| exchange_rates | Object | A JSON Object containing each of the target currency as the key and its exchange rate versus the base currency as that key's value. |\n\n### `historical` response parameters\n\n| Parameter | Type | Details |\n| - | - | - |\n| base | String | The base currency used to get the exchange rates. |\n| date | String | The date the currencies were pulled from, per the successful request. |\n| exchange_rates | Object | A JSON Object containing each of the target currency as the key and its exchange rate versus the base currency as that key's value. |\n\n### `convert` response parameters\n\n| Parameter | Type | Details |\n| - | - | - |\n| base | String | The base currency used to get the exchange rates. |\n| target | String | The target currency that the base_amount was converted into. |\n| date | String | The date the currencies were pulled from, per the successful request. |\n| base_amount | Float | The amount of the base currency from the request. |\n| converted_amount | Float | The amount of the target currency that the base_amount has been converted into |\n| exchange_rate | Float | The exchange rate used to convert the base_amount from the base currency to the target currency |\n\n## Detailed documentation\n\nYou will find additional information and request examples in the [Abstract help page](https://app.abstractapi.com/api/exchange-rates/documentation).\n\n## Getting help\n\nIf you need help installing or using the library, please contact [Abstract's Support](https://app.abstractapi.com/api/exchange-rates/support).\n\nFor bug report and feature suggestion, please use [this repository issues page](https://github.com/abstractapi/javascript-exchange-rates/issues).\n\n# Contribution\n\nContributions are always welcome, as they improve the quality of the libraries we provide to the community.\n\nPlease provide your changes covered by the appropriate unit tests, and post them in the [pull requests page](https://github.com/abstractapi/javascript-exchange-rates/pulls).\n\n## NPM\n\n### Installation\n\nRun `npm install` in the command line to install the dependencies. To update those dependencies you need to run `npm update`.\n\n### Building\n\nTo build the library and generate the minified file in the *dist* directory, you need to run `npm run build`.\n\nTo build the lib, you need to run `npm run build:lib`.\n\n### Test\n\nTo run the test suite, you need the API key from the abstract website and you can run:\n\n    EXCHANGE_RATES_API_KEY=(your key here) npm run test\n\n","readmeFilename":"README.md"}