fix: remove a redundant condition check (#2578)

Condition 'list' is always true. The value of variable 'list' is originated from the array created at line 20 .
This commit is contained in:
Henry Wang 2019-07-08 04:47:56 +01:00 committed by DIYgod
parent eeec8494d4
commit 69d3550b1e
1 changed files with 21 additions and 23 deletions

View File

@ -28,28 +28,26 @@ module.exports = async (ctx) => {
title: 'RSSHub 有新路由啦',
link: 'https://docs.rsshub.app',
description: '万物皆可 RSS',
item:
list &&
list.map(({ item, type }) => {
item = cheerio(item);
item.find('.header-anchor').remove();
const titleEle = item.prevAll('h2').eq(0);
return {
title: `${titleEle[0].attribs.id} - ${item
.prevAll('h3')
.eq(0)
.text()
.slice(2)}`,
description: item.html(),
link: `https://docs.rsshub.app/${type}.html#${encodeURIComponent(
titleEle.find('.header-anchor').attr('href') &&
titleEle
.find('.header-anchor')
.attr('href')
.slice(1)
)}`,
guid: item.attr('id'),
};
}),
item: list.map(({ item, type }) => {
item = cheerio(item);
item.find('.header-anchor').remove();
const titleEle = item.prevAll('h2').eq(0);
return {
title: `${titleEle[0].attribs.id} - ${item
.prevAll('h3')
.eq(0)
.text()
.slice(2)}`,
description: item.html(),
link: `https://docs.rsshub.app/${type}.html#${encodeURIComponent(
titleEle.find('.header-anchor').attr('href') &&
titleEle
.find('.header-anchor')
.attr('href')
.slice(1)
)}`,
guid: item.attr('id'),
};
}),
};
};