@apiverve/horoscope 1.0.2 → 1.1.2

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 (3) hide show
  1. package/README.md +12 -7
  2. package/index.js +16 -7
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -71,17 +71,22 @@ api.execute(query, function (error, data) {
71
71
  "status": "ok",
72
72
  "error": null,
73
73
  "data": {
74
- "color": "purple",
74
+ "color": "orange",
75
75
  "compatibility": [
76
76
  "leo",
77
77
  "sagittarius"
78
78
  ],
79
- "date": "Fri May 10 2024",
80
- "horoscope": "Today is a good day to delve into your creative side, Aries. Allow yourself to explore new hobbies or projects that spark your imagination. Your intuition is strong right now, so trust your gut when making decisions. Focus on self-care and take time to recharge your energy. It's important to set boundaries with others to protect your own well-being. Embrace new opportunities that come your way and don't be afraid to step out of your comfort zone.",
81
- "luckyNumber": 38,
82
- "luckyTime": "10:00 PM",
83
- "mood": "happy",
84
- "sign": "aries"
79
+ "horoscope": "Today is the perfect day to focus on your personal growth and development, Aries. You may find yourself feeling creative and inspired, so make sure to channel that energy into something productive. Take some time to reflect on your goals and aspirations, and make a plan for how you can achieve them. Remember to stay true to yourself and trust your instincts as you move forward.",
80
+ "luckyNumber": 50,
81
+ "luckyTime": "2:00 PM",
82
+ "mood": "anxious",
83
+ "sign": "aries",
84
+ "zodiac": {
85
+ "element": "fire",
86
+ "name": "Aries",
87
+ "stone": "bloodstone",
88
+ "symbol": "♈"
89
+ }
85
90
  }
86
91
  }
87
92
  ```
package/index.js CHANGED
@@ -24,8 +24,13 @@ class horoscopeWrapper {
24
24
  }
25
25
 
26
26
  async execute(query, callback) {
27
- if (!query || typeof query !== 'object') {
28
- throw new Error('Query parameters must be provided as an object.');
27
+ if(arguments.length > 1) {
28
+ if (!query || typeof query !== 'object') {
29
+ throw new Error('Query parameters must be provided as an object.');
30
+ }
31
+ } else {
32
+ callback = query;
33
+ query = {};
29
34
  }
30
35
 
31
36
  var requiredParams = ["sign"];
@@ -68,11 +73,15 @@ class horoscopeWrapper {
68
73
 
69
74
  constructURL(query) {
70
75
  let url = this.baseURL;
71
- if (Object.keys(query).length > 0) {
72
- const queryString = Object.keys(query)
73
- .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
74
- .join('&');
75
- url += `?${queryString}`;
76
+
77
+ if(query && typeof query === 'object')
78
+ {
79
+ if (Object.keys(query).length > 0) {
80
+ const queryString = Object.keys(query)
81
+ .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
82
+ .join('&');
83
+ url += `?${queryString}`;
84
+ }
76
85
  }
77
86
  return url;
78
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apiverve/horoscope",
3
- "version": "1.0.2",
3
+ "version": "1.1.2",
4
4
  "description": "Horoscope is a simple tool for getting horoscope data. It returns the horoscope for the day.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,13 +20,13 @@
20
20
  },
21
21
  "homepage": "https://github.com/apiverve/horoscope-API",
22
22
  "devDependencies": {
23
- "mocha": "^2.3.4",
24
- "chai": "^3.4.1",
25
- "dotenv": "^2.0.0"
23
+ "mocha": "^10.4.0",
24
+ "chai": "^5.1.1",
25
+ "dotenv": "^16.4.5"
26
26
  },
27
27
  "dependencies": {
28
28
  "node-fetch": "3.3.2",
29
- "promise": "^7.1.1",
30
- "axios": "^0.15.3"
29
+ "promise": "^8.3.0",
30
+ "axios": "1.6.8"
31
31
  }
32
32
  }