RSSHub/lib/routes/mrdx/utils.ts

16 lines
374 B
TypeScript

function getElementChildrenInnerText(element) {
let text = '';
for (const child of element.children) {
if (child.type === 'text') {
text += child.data.trim();
}
if (child.children !== undefined) {
text += getElementChildrenInnerText(child);
}
}
return text;
}
export { getElementChildrenInnerText };