Published
Edited
Mar 10, 2020
1 fork
5 stars
Insert cell
Insert cell
astronauts = [
'Neil Armstrong',
'Buzz Aldrin',
'Pete Conrad',
'Alan Bean',
'Alan Shepard',
'Edgar Mitchell',
'David Scott',
'James Irwin',
'John Young (astronaut)',
'Charles Duke',
'Eugene Cernan',
'Harrison Schmitt',
'Frank Borman',
'Jim Lovell',
'Bill Anders',
'Thomas P. Stafford',
'Michael Collins (astronaut)',
'Richard F. Gordon Jr.',
'Jack Swigert',
'Fred Haise',
'Stu Roosa',
'Al Worden',
'Ken Mattingly',
'Ron Evans'
]
Insert cell
Insert cell
groups = chunkBy(astronauts, 5)
Insert cell
Insert cell
docs = {
let opts = {'Api-User-Agent': 'wtf_wikipedia example'}
const doit = function(group){
return wtf.fetch(group, opts) //returns a promise
}
//only allow three requests at a time
return slow.three(groups, doit).then(responses=>{
//flatten the results
return [].concat.apply([], responses);
})
}
Insert cell
Insert cell
birthDays = {
return docs.map(doc => {
let birthday = null
// no infobox for Richard Gordon
if (doc.infobox() && doc.infobox().get('birth_date')) {
birthday = doc
.infobox()
.get('birth_date')
.text()
}
return {
name: doc.title(),
birthday: birthday
}
})
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more