(listElements)
| 8 | export const rootUrl = 'https://www.30secondsofcode.org'; |
| 9 | |
| 10 | export async function processList(listElements) { |
| 11 | const items = await Promise.allSettled( |
| 12 | listElements.map((item) => { |
| 13 | const $ = load(item); |
| 14 | const link = $(' article > h3 > a').attr('href'); |
| 15 | const date = $(' article > small > time').attr('datetime'); |
| 16 | return processItem({ link, date }); |
| 17 | }) |
| 18 | ); |
| 19 | return items.map((item) => (item.status === 'fulfilled' ? item.value : ({ title: 'Error Reading Item' } as DataItem))); |
| 20 | } |
| 21 | |
| 22 | async function processItem({ link: articleLink, date }) { |
| 23 | return await cache.tryGet(`30secondsofcode:${articleLink}`, async () => { |
no test coverage detected