cheerio
cheerio copied to clipboard
Incorrect code example in intro documation
I was reading the "Basic loading" documentation and pressed the copy button in order to receive the intro code from the docs:
import * as cheerio from 'cheerio';
const $ = cheerio.load('<html><body><h1>Hello, world!</h1></body></html>');
console.log($('title').text());
// Output: Hello, world!
However, the console log turns out empty is empty. This is because it's trying to select and log "title" which does not exist in the provided code: <html><body><h1>Hello, world!</h1></body></html>
So the output "// Output: Hello, world!" is just ""