@apiverve/babynamegenerator 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.
- package/README.md +11 -46
- package/index.js +16 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -72,57 +72,22 @@ api.execute(query, function (error, data) {
|
|
|
72
72
|
"status": "ok",
|
|
73
73
|
"error": null,
|
|
74
74
|
"data": {
|
|
75
|
-
"count":
|
|
75
|
+
"count": 3,
|
|
76
76
|
"names": [
|
|
77
77
|
{
|
|
78
|
-
"firstName": "
|
|
79
|
-
"middleName": "
|
|
80
|
-
"fullName": "
|
|
78
|
+
"firstName": "Linda",
|
|
79
|
+
"middleName": "Ruth",
|
|
80
|
+
"fullName": "Linda Ruth"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
"firstName": "
|
|
84
|
-
"middleName": "
|
|
85
|
-
"fullName": "
|
|
83
|
+
"firstName": "Megan",
|
|
84
|
+
"middleName": "Maureen",
|
|
85
|
+
"fullName": "Megan Maureen"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
"firstName": "
|
|
89
|
-
"middleName": "
|
|
90
|
-
"fullName": "
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"firstName": "Lucia",
|
|
94
|
-
"middleName": "Toni",
|
|
95
|
-
"fullName": "Lucia Toni"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"firstName": "Carrie",
|
|
99
|
-
"middleName": "Bonnie",
|
|
100
|
-
"fullName": "Carrie Bonnie"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"firstName": "Samantha",
|
|
104
|
-
"middleName": "Roberta",
|
|
105
|
-
"fullName": "Samantha Roberta"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"firstName": "Gwendolyn",
|
|
109
|
-
"middleName": "Constance",
|
|
110
|
-
"fullName": "Gwendolyn Constance"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"firstName": "Flora",
|
|
114
|
-
"middleName": "Opal",
|
|
115
|
-
"fullName": "Flora Opal"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"firstName": "Terry",
|
|
119
|
-
"middleName": "Linda",
|
|
120
|
-
"fullName": "Terry Linda"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"firstName": "Clara",
|
|
124
|
-
"middleName": "Lora",
|
|
125
|
-
"fullName": "Clara Lora"
|
|
88
|
+
"firstName": "Jill",
|
|
89
|
+
"middleName": "Jane",
|
|
90
|
+
"fullName": "Jill Jane"
|
|
126
91
|
}
|
|
127
92
|
]
|
|
128
93
|
}
|
|
@@ -144,7 +109,7 @@ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Tw
|
|
|
144
109
|
|
|
145
110
|
## Legal
|
|
146
111
|
|
|
147
|
-
All usage of the
|
|
112
|
+
All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms) and all legal documents and agreements.
|
|
148
113
|
|
|
149
114
|
---
|
|
150
115
|
|
package/index.js
CHANGED
|
@@ -24,8 +24,13 @@ class babynamegeneratorWrapper {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async execute(query, callback) {
|
|
27
|
-
if
|
|
28
|
-
|
|
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 = ["gender"];
|
|
@@ -68,11 +73,15 @@ class babynamegeneratorWrapper {
|
|
|
68
73
|
|
|
69
74
|
constructURL(query) {
|
|
70
75
|
let url = this.baseURL;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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/babynamegenerator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Baby Name Generator is a simple tool for generating baby names. It returns a list of baby names.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/apiverve/babynamegenerator-API",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"mocha": "^
|
|
24
|
-
"chai": "^
|
|
25
|
-
"dotenv": "^
|
|
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": "^
|
|
30
|
-
"axios": "
|
|
29
|
+
"promise": "^8.3.0",
|
|
30
|
+
"axios": "1.6.8"
|
|
31
31
|
}
|
|
32
32
|
}
|