JSFiddle - React, Tailwind, and code Playground

by mcsf

JavaScript

fetch('https://api.github.com/users/afercia/events/public?per_page=100')
.then(response => response.json())
.then(events => events.filter(isGutenbergComment))
.then(comments => comments.map(toString))
.then(formatted => formatted.forEach(print))

function isGutenbergComment({repo, type}) {
      return (
        repo.name === 'WordPress/gutenberg' &&
        (
            type === 'IssueCommentEvent' ||
            type === 'IssueEvent'
            )
        )
}

function toString({payload}) {
    return `
      <article>
        <header><strong>
          <a href="${payload.issue.url}">
            ${payload.issue.title}
                </a>
            </strong> (${payload.comment.created_at})</header>
      <p>${payload.comment.body}</p>
        </article>
    `               
}

function print(string) {
    document.body.innerHTML += string
}