///
class Provider {
async test() {
const html = `
Test Document
First Post
This is the first post.
Read more
Second Post
This is the second post.
Read more
Third Post
This is the third post.
Read more
`
const $ = new Doc(html)
console.log("Document created")
console.log(">>> Last post by string selector")
const article = $.find("article:last-child")
console.log(article.html())
console.log(">>> Post titles (map to string)")
const titles = $.find("section")
.children("article.post")
.filter((i, e) => {
return e.attr("data-id") !== "1"
})
.map((i, e) => {
return e.children("h2").text()
})
console.log(titles)
console.log(">>> END")
}
}