generate.js — react Source File
Architecture documentation for generate.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
'use strict';
const fetch = require('node-fetch');
const {writeFileSync} = require('fs');
const stories = 50;
async function getStory(id) {
const storyRes = await fetch(
`https://hacker-news.firebaseio.com/v0/item/${id}.json`
);
return await storyRes.json();
}
async function getTopStories() {
const topStoriesRes = await fetch(
'https://hacker-news.firebaseio.com/v0/topstories.js'
);
const topStoriesIds = await topStoriesRes.json();
const topStories = [];
for (let i = 0; i < stories; i++) {
const topStoriesId = topStoriesIds[i];
topStories.push(await getStory(topStoriesId));
}
writeFileSync(
'top-stories.json',
`window.stories = ${JSON.stringify(topStories)}`
);
}
getTopStories();
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does generate.js do?
generate.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in generate.js?
generate.js defines 2 function(s): getStory, getTopStories.
Where is generate.js in the architecture?
generate.js is located at scripts/bench/benchmarks/hacker-news/generate.js (domain: BabelCompiler, subdomain: Optimization, directory: scripts/bench/benchmarks/hacker-news).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free