UNPKG

hackernews-cli-tool

Version:
7 lines (6 loc) 179 B
export default function getUrlByIndex(news, index) { if (news[index].url) { return news[index].url; } return `https://news.ycombinator.com/item?id=${news[index].id}`; }