Skip to content

Instantly share code, notes, and snippets.

@fitsum
Last active January 15, 2020 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitsum/2cfad7067f0f23ac3e243b7636a6a243 to your computer and use it in GitHub Desktop.
Save fitsum/2cfad7067f0f23ac3e243b7636a6a243 to your computer and use it in GitHub Desktop.
bible api stuffs
fetch('https://api.scripture.api.bible/v1/bibles', {headers: {'api-key': 'ace65b88c21bc3d190f3f95754e2eede'}})
.then((r) => r.json())
.then((j) => {
const worldenglish = j.data.filter(item => item.name.indexOf('World English Bible') !== -1 ).map((item) => {return {"name":item.name, "description": item.description}});
console.table(worldenglish);
});
// Feeling fine about using `indexOf`
// https://stackoverflow.com/a/54538979
//or IIFE with async/wait
(async () => {
let f = await fetch('https://api.scripture.api.bible/v1/bibles', {headers: {'api-key': 'ace65b88c21bc3d190f3f95754e2eede'}});
let j = await f.json();
const worldenglish = j.data.filter(item => item.name.indexOf('World English Bible') !== -1 ).map((item) => {return {"name":item.name, "description": item.description}});
console.table(worldenglish);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment