Skip to content

Commit f79ba06

Browse files
committed
rewrite: fix linting errors
1 parent 9abb790 commit f79ba06

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rewrite.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ const findDownload = acquire => {
1313
const result = {};
1414

1515
if (download) {
16-
result.download = download.href;
16+
result.download = download.href;
1717
}
1818

1919
return result;
2020
};
2121

2222
const findImage = images => {
2323
const result = {};
24-
if (images && images.length){
24+
if (images && images.length) {
2525
const image = images.pop();
2626
const imageUrl = image.href;
2727

@@ -34,25 +34,25 @@ const findImage = images => {
3434
return result;
3535
};
3636

37-
var rewritten = publications
37+
const rewritten = publications
3838
.map(publication => {
3939
const image = findImage(publication.images);
4040
const download = findDownload(publication.acquire);
4141
// id is a url, and the actual number is the last part of it:
4242
const idParts = publication.metadata.id.split('/');
4343
const id = Number(idParts[idParts.length - 2]);
4444
return Object.assign({},
45-
download, image, omit(publication.metadata, '\@type', 'summary', 'category', 'rating'),
45+
download, image, omit(publication.metadata, '@type', 'summary', 'category', 'rating'),
4646
{
4747
id,
4848
summary: sanitizeHtml(publication.metadata.summary),
49-
rating: parseInt(publication.metadata.rating.ratingValue),
49+
rating: parseInt(publication.metadata.rating.ratingValue, 10),
5050
// Randomly select books as own:
5151
isOwn: Math.random() > 0.993
5252
}
5353
);
5454
})
55-
.filter(publication => publication.download);
55+
.filter(publication => publication.download)
56+
.sort((a, b) => b.rating - a.rating);
5657

57-
rewritten.sort(function(a, b) {return b.rating - a.rating;});
5858
process.stdout.write(JSON.stringify(rewritten));

0 commit comments

Comments
 (0)