MCPcopy Index your code
hub / github.com/freeCodeCamp/freeCodeCamp / getBlockMetadata

Function getBlockMetadata

client/utils/build-challenges.js:28–44  ·  view source on GitHub ↗
(block, superBlock)

Source from the content-addressed store, hash-verified

26const blockCreator = getBlockCreator(curriculumLocale);
27
28function getBlockMetadata(block, superBlock) {
29 // Compute metadata for the given block in the specified superblock
30 const sbFilename = superBlockToFilename[superBlock];
31 const sbData = getSuperblockStructure(sbFilename);
32 const blocks = transformSuperBlock(sbData, {
33 showComingSoon: process.env.SHOW_UPCOMING_CHANGES === 'true'
34 });
35
36 const order = blocks.findIndex(b => b.dashedName === block);
37 const superOrder = getSuperOrder(superBlock);
38
39 if (order === -1) {
40 throw new Error(`Block ${block} not found in superblock ${superBlock}`);
41 }
42
43 return { order, superOrder };
44}
45
46exports.replaceChallengeNodes = () => {
47 return async function replaceChallengeNodes(filePath) {

Callers 1

Calls 3

getSuperblockStructureFunction · 0.85
transformSuperBlockFunction · 0.85
getSuperOrderFunction · 0.85

Tested by

no test coverage detected