Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushmajit committed Apr 25, 2022
1 parent 067d205 commit 69a69c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app.post('/search', async function(req, res) {

if (!validationResponse.isValid) {
res.status(validationResponse.statusCode);
res.json({error: validationResponse.errorMessage})
res.json({error: validationResponse.errorMessage});
return ;
}

Expand Down Expand Up @@ -112,7 +112,7 @@ app.post('/getPlugins', async function(req, res) {

if (!validationResponse.isValid) {
res.status(validationResponse.statusCode);
res.json({error: validationResponse.errorMessage})
res.json({error: validationResponse.errorMessage});
return ;
}

Expand Down
12 changes: 6 additions & 6 deletions src/npm_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ async function updateDownloadStats(searchList) {
let element = searchList[i];
if (element.hasOwnProperty('_source') && element._source.hasOwnProperty('totalDownloads')
&& element._source.hasOwnProperty('metadata')) {
let packageName = NPM_PACKAGE_PREFIX + searchList[i]._source.metadata.name;
try {
let packageName = NPM_PACKAGE_PREFIX + searchList[i]._source.metadata.name;
let npmTotalDownloads = 0;
let npmResponse = await getNpmStats(packageName, NPM_STATS_START_DATE, CURR_DATE);
npmTotalDownloads = npmResponse.body.downloads;
element._source.npmDownloads = npmTotalDownloads;
element._source.totalDownloads += npmTotalDownloads;
} catch (err) {
console.error("Error Updating Download data for Package :" + packageName
+ " Reason: " + JSON.stringify(err));
console.error("Error Updating Download data for Package :" + packageName
+ " Reason: " + JSON.stringify(err));
}
}
modifiedList.push(element);
Expand All @@ -66,14 +66,14 @@ async function getNpmStats(pkg, start, end) {
.get(url)
.timeout({
response: 3 * 1000,
deadline: 5 * 1000,
deadline: 5 * 1000
});
if (!res && res.hasOwnProperty('statusCode') && res.statusCode === 400) {
throw new Error("Error retrieving details from NPM API");
}
}
return {
statusCode: res.statusCode,
body: body,
body: body
};
} catch (err) {
throw err;
Expand Down

0 comments on commit 69a69c0

Please sign in to comment.