bitpay-rates 1.2.3 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # bitpay-rates
2
2
 
3
- [![Build Status](https://img.shields.io/travis/bycolco/bitpay-rates.svg?style=flat-square)](https://travis-ci.org/bycolco/bitpay-rates)
4
3
  [![BundlePhobia](https://img.shields.io/bundlephobia/min/bitpay-rates.svg?style=flat-square)](https://bundlephobia.com/result?p=bitpay-rates)
5
4
  [![BundlePhobia](https://img.shields.io/bundlephobia/minzip/bitpay-rates.svg?style=flat-square)](https://bundlephobia.com/result?p=bitpay-rates)
6
5
 
@@ -19,7 +18,7 @@ Getting a rate by code
19
18
  ```js
20
19
  import bitpayRates from 'bitpay-rates';
21
20
 
22
- const code = 'BUSD'; // see list of codes bellow
21
+ const code = 'ARS'; // see list of codes bellow
23
22
 
24
23
  // Using promise
25
24
  const ratePromise = bitpayRates.get(code);
@@ -38,9 +37,9 @@ Successful response
38
37
 
39
38
  ```json
40
39
  {
41
- "code": "BUSD",
42
- "name": "Binance USD",
43
- "rate": 57818.28
40
+ "code": "ARS",
41
+ "name": "Argentine Peso",
42
+ "rate": 3793422.92
44
43
  }
45
44
  ```
46
45
 
@@ -80,9 +79,9 @@ Successful response
80
79
  ]
81
80
  ```
82
81
 
83
- ## Available Codes (updated: 2021-03-21)
82
+ ## Available Codes (updated: 2023-01-11)
84
83
 
85
- [Follow this link](CODES.md#available-codes-updated-2021-03-21) to see the complete list of 169 codes.
84
+ [Follow this link](CODES.md) to see the complete list of codes.
86
85
 
87
86
  ## Related Packages
88
87
 
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- declare type Callback=(...args:any[])=>void;declare type RateObj={code:string;name:string;rate:number;};export declare const get:(code?:string|Callback|undefined,callback?:Callback|undefined)=>Promise<RateObj>|Promise<[RateObj]>|void;declare const _default:{get:(code?:string|Callback|undefined,callback?:Callback|undefined)=>void|Promise<RateObj>|Promise<[RateObj]>;};export default _default;
1
+ export type RateObj={code:string;name:string;rate:number;};export type RateResponse=RateObj|[RateObj];export type Callback=(error:Error|null,data?:RateResponse)=>void;export declare const get:(code?:string|Callback,callback?:Callback)=>Promise<RateResponse>|void;declare const _default:{get:(code?:string|Callback|undefined,callback?:Callback|undefined)=>void|Promise<RateResponse>;};export default _default;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __createBinding=(this&&this.__createBinding)||(Object.create?(function(o,m,k,k2){if(k2===undefined)k2=k;Object.defineProperty(o,k2,{enumerable:true,get:function(){return m[k];}});}):(function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k];}));var __setModuleDefault=(this&&this.__setModuleDefault)||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:true,value:v});}):function(o,v){o["default"]=v;});var __importStar=(this&&this.__importStar)||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k))__createBinding(result,mod,k);__setModuleDefault(result,mod);return result;};Object.defineProperty(exports,"__esModule",{value:true});exports.get=void 0;const https=__importStar(require("https"));const returnPromise=(options)=>{return new Promise((resolve,reject)=>{returnCallback(options,(err,data)=>{if(err)return reject(err);return resolve(data);});});};const returnCallback=(options,callback)=>{https.get(options,(res)=>{let dataBuffer='';res.on('data',(chunk)=>{dataBuffer+=chunk.toString('utf8');});res.on('end',()=>{try{const{data}=JSON.parse(dataBuffer);return callback(null,data);}catch(err){return callback(err);}});}).on('error',(err)=>{return callback(err);});};const get=(code,callback)=>{const options={host:'bitpay.com',path:'/rates',headers:{},agent:false,};if(typeof code==='function'){return returnCallback(options,code);}else if(typeof code==='string'){options.path+=`/${code.toUpperCase()}`;if(callback){return returnCallback(options,callback);}return returnPromise(options);}else if(typeof code==='undefined'){return returnPromise(options);}};exports.get=get;exports.default={get:exports.get};
1
+ "use strict";var __importDefault=(this&&this.__importDefault)||function(mod){return(mod&&mod.__esModule)?mod:{"default":mod};};Object.defineProperty(exports,"__esModule",{value:true});exports.get=void 0;const https_1=__importDefault(require("https"));const defaultOptions={host:'bitpay.com',path:'/rates',headers:{},agent:false,};const returnPromise=(options)=>{return new Promise((resolve,reject)=>{returnCallback(options,(err,data)=>{if(err)return reject(err);return resolve(data);});});};const returnCallback=(options,callback)=>{https_1.default.get(options,(res)=>{let dataBuffer='';res.on('data',(chunk)=>{dataBuffer+=chunk.toString('utf8');});res.on('end',()=>{try{const{data}=JSON.parse(dataBuffer);return callback(null,data);}catch(err){return callback(err);}});}).on('error',(err)=>{return callback(err);});};const get=(code,callback)=>{const options={...defaultOptions};if(typeof code==='string'){options.path+=`/${code.toUpperCase()}`;}if(typeof code==='function'){return returnCallback(options,code);}else if(callback){return returnCallback(options,callback);}else{return returnPromise(options);}};exports.get=get;exports.default={get:exports.get};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitpay-rates",
3
- "version": "1.2.3",
3
+ "version": "1.2.9",
4
4
  "description": "A tiny NodeJS wrapper for the BitPay Rates API",
5
5
  "engines": {
6
6
  "node": ">=10"
@@ -12,18 +12,18 @@
12
12
  "countries",
13
13
  "price"
14
14
  ],
15
- "author": "Mario Colque <bycolco@gmail.com>",
15
+ "author": "Mario Colque <dev@colkito.com>",
16
16
  "license": "MIT",
17
17
  "main": "dist/index.js",
18
18
  "types": "dist/index.d.ts",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/bycolco/bitpay-rates.git"
21
+ "url": "https://github.com/colkito/bitpay-rates.git"
22
22
  },
23
23
  "bugs": {
24
- "url": "https://github.com/bycolco/bitpay-rates/issues"
24
+ "url": "https://github.com/colkito/bitpay-rates/issues"
25
25
  },
26
- "homepage": "https://github.com/bycolco/bitpay-rates#readme",
26
+ "homepage": "https://github.com/colkito/bitpay-rates#readme",
27
27
  "scripts": {
28
28
  "test": "jest",
29
29
  "test:watch": "jest --watch",