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:
parent
eeec8494d4
commit
69d3550b1e
|
|
@ -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'),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue