JSFiddle - React, Tailwind, and code Playground

by findango

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>

JavaScript

const getLastCommit = async (repo) => {
	const resp = await fetch(`https://api.github.com/repos/splunk/${repo.name}/commits?per_page=1`);
  const commit =  await resp.json();
  console.log(commit)
	return commit[0];
};

const getRepos = async () => {
	const resp = await fetch('https://api.github.com/orgs/splunk/repos?per_page=3');
	const repos = await resp.json();
  
	for (r of repos) {
  	const commit = await getLastCommit(r);
    r.last_committer = commit.author.id;
  }  

  return repos.map(r => _.pick(r, ['id', 'name', 'forks', 'stargazers_count', 'last_committer']));
};

(async () => {
		const repos = await getRepos();
		console.log('Repos:', repos);
})();