Nice one Dennis. I tested it out and it works.
I converted it from an explicit Promise idiom to an async-await idiom....
const Xray = require('x-ray'); //util const lpromise = p => p.then(o => console.log(o.items)); /* @func retrieve posts using xray @typedef {{items: string[]}} itemsObj @return {Promise<itemsObj>} */ const getPosts = async () => { const x = Xray(); const url = "https://blog.dennisokeeffe.com"; try { return await x(url, "main:last-child", { items: x("div", [ { title: "h3 > a", description: "p", link: "h3 > a@href", date: "small", }, ]), }); } catch (err) { console.error(err); } }; //@tests lpromise(getPosts());
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice one Dennis.
I tested it out and it works.
I converted it from an explicit Promise idiom to an async-await idiom....