Skip to content

Commit 936af89

Browse files
authoredDec 30, 2020
fix(deps): upgrade to cheerio 1.0.0-rc.5 (#229)
1 parent 96a8750 commit 936af89

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"chalk": "^4.0.0",
25-
"cheerio": "^1.0.0-rc.2",
25+
"cheerio": "^1.0.0-rc.5",
2626
"gaxios": "^4.0.0",
2727
"glob": "^7.1.6",
2828
"jsonexport": "^3.0.0",
@@ -35,7 +35,7 @@
3535
},
3636
"devDependencies": {
3737
"@types/chai": "^4.2.7",
38-
"@types/cheerio": "0.22.22",
38+
"@types/cheerio": "0.22.23",
3939
"@types/glob": "^7.1.3",
4040
"@types/marked": "^1.2.0",
4141
"@types/meow": "^5.0.0",

‎src/links.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export function getLinks(source: string, baseUrl: string): ParsedUrl[] {
4747
const attrs = Object.keys(linksAttr);
4848
for (const attr of attrs) {
4949
const elements = linksAttr[attr].map(tag => `${tag}[${attr}]`).join(',');
50-
$(elements).each((i, element) => {
50+
$(elements).each((i, ele) => {
51+
const element = ele as cheerio.TagElement;
52+
if (!element.attribs) {
53+
return;
54+
}
5155
const values = parseAttr(attr, element.attribs[attr]);
5256
// ignore href properties for link tags where rel is likely to fail
5357
const relValuesToIgnore = ['dns-prefetch', 'preconnect'];

0 commit comments

Comments
 (0)
Please sign in to comment.