MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / buildBlock

Function buildBlock

curriculum/src/build-superblock.ts:123–139  ·  view source on GitHub ↗
(foundChallenges: Challenge[], meta: Meta)

Source from the content-addressed store, hash-verified

121 * @returns {object} Block object with ordered challenges
122 */
123export function buildBlock(foundChallenges: Challenge[], meta: Meta) {
124 const challenges = meta.challengeOrder.map(challengeInfo => {
125 const challenge = foundChallenges.find(c => c.id === challengeInfo.id);
126 if (!challenge) {
127 throw Error(
128 `Challenge ${challengeInfo.id} (${challengeInfo.title}) not found in block`
129 );
130 }
131
132 return challenge;
133 });
134
135 return {
136 challenges,
137 meta
138 };
139}
140
141/**
142 * Adds the meta information to a challenge

Callers 2

processBlockMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected