Published
Edited
Sep 29, 2018
1 star
Insert cell
Insert cell
Insert cell
Insert cell
function recursiveCommentFetch(user, data = [], { after, limit = 100 } = {}) {
const url = makeRedditCommentUrl(user, { after, limit });
return fetch(url)
.then(res => res.json())
.then(res => {
const { after, children } = res.data;
const newData = [...data, ...children];
if (after) {
return recursiveCommentFetch(user, newData, { after });
}
return newData;
});
}
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