bitpay-rates 1.2.10 → 1.2.16

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.
Files changed (2) hide show
  1. package/README.md +13 -23
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -3,17 +3,17 @@
3
3
  [![BundlePhobia](https://img.shields.io/bundlephobia/min/bitpay-rates.svg?style=flat-square)](https://bundlephobia.com/result?p=bitpay-rates)
4
4
  [![BundlePhobia](https://img.shields.io/bundlephobia/minzip/bitpay-rates.svg?style=flat-square)](https://bundlephobia.com/result?p=bitpay-rates)
5
5
 
6
- 📈 A tiny (and zero-deps) wrapper for the [BitPay](https://bitpay.com/rates) Rates API. Now written in TypeScript.
6
+ A lightweight Node.js wrapper for [BitPay's](https://bitpay.com/rates) exchange rates API, now in TypeScript.
7
7
 
8
- This module returns a `Promise` but can be used with a `Callback` as well. ✨
8
+ Zero-dependency, `promise` and `callback` support for easy integration into your project. ✨
9
9
 
10
10
  ## Requirements
11
11
 
12
- - nodejs >= 10.x
12
+ - nodejs >= 12.x
13
13
 
14
14
  ## Examples
15
15
 
16
- Getting a rate by code
16
+ Getting a rate by `code`:
17
17
 
18
18
  ```js
19
19
  import bitpayRates from 'bitpay-rates';
@@ -21,19 +21,13 @@ import bitpayRates from 'bitpay-rates';
21
21
  const code = 'ARS'; // see list of codes bellow
22
22
 
23
23
  // Using promise
24
- const ratePromise = bitpayRates.get(code);
25
- ratePromise
24
+ bitpayRates
25
+ .get(code)
26
26
  .then((rate) => console.log('Promise Rate:', rate))
27
- .catch((err) => console.log('Promise Error:', err));
28
-
29
- // Using callback
30
- bitpayRates.get(code, (err, res) => {
31
- console.log('Callback Error:', err);
32
- console.log('Callback Rate:', res);
33
- });
27
+ .catch((err) => console.error('Promise Error:', err));
34
28
  ```
35
29
 
36
- Successful response
30
+ Successful response:
37
31
 
38
32
  ```json
39
33
  {
@@ -43,25 +37,19 @@ Successful response
43
37
  }
44
38
  ```
45
39
 
46
- Getting all the rates
40
+ Getting `all` the rates:
47
41
 
48
42
  ```js
49
43
  import bitpayRates from 'bitpay-rates';
50
44
 
51
- // Using promise
52
- const ratesPromise = bitpayRates.get();
53
- ratesPromise
54
- .then((rates) => console.log('Promise Rates:', rates))
55
- .catch((err) => console.log('Promise Error:', err));
56
-
57
45
  // Using callback
58
46
  bitpayRates.get((err, res) => {
59
- console.log('Callback Error:', err);
47
+ console.error('Callback Error:', err);
60
48
  console.log('Callback Rates:', res);
61
49
  });
62
50
  ```
63
51
 
64
- Successful response
52
+ Successful response:
65
53
 
66
54
  ```json
67
55
  [
@@ -79,6 +67,8 @@ Successful response
79
67
  ]
80
68
  ```
81
69
 
70
+ More examples [here](example/rates-example.js).
71
+
82
72
  ## Available Codes (updated: 2023-01-11)
83
73
 
84
74
  [Follow this link](CODES.md) to see the complete list of codes.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "bitpay-rates",
3
- "version": "1.2.10",
4
- "description": "A tiny NodeJS wrapper for the BitPay Rates API",
3
+ "version": "1.2.16",
4
+ "description": "A tiny Node.js wrapper for the BitPay Rates API",
5
5
  "engines": {
6
- "node": ">=10"
6
+ "node": ">=12"
7
7
  },
8
8
  "keywords": [
9
9
  "bitcoin",
@@ -35,7 +35,7 @@
35
35
  "minifyDeclarations": "jsmin -l 3 -o dist/index.d.ts dist/index.d.ts",
36
36
  "prepublishOnly": "npm test && npm run lint && npm run build",
37
37
  "preversion": "npm run lint",
38
- "version": "npm run format && git add -A src",
38
+ "version": "npm run format && git add -A src package.json",
39
39
  "postversion": "git push && git push --tags"
40
40
  },
41
41
  "devDependencies": {