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

Function fixChallengeProperties

curriculum/src/build-superblock.ts:238–254  ·  view source on GitHub ↗
(challenge: Challenge)

Source from the content-addressed store, hash-verified

236 * @returns {object} The challenge object with fixed properties
237 */
238export function fixChallengeProperties(challenge: Challenge) {
239 const fixedChallenge = {
240 ...challenge
241 };
242
243 if (challenge.challengeFiles) {
244 fixedChallenge.challengeFiles = challengeFilesToPolys(
245 challenge.challengeFiles
246 );
247 }
248 if (challenge.solutions?.length) {
249 // The test runner needs the solutions to be arrays of polyvinyls so it
250 // can sort them correctly.
251 fixedChallenge.solutions = challenge.solutions.map(challengeFilesToPolys);
252 }
253 return fixedChallenge;
254}
255
256/**
257 * Finalizes a challenge by fixing properties and adding meta information

Callers 2

finalizeChallengeFunction · 0.85

Calls 1

challengeFilesToPolysFunction · 0.85

Tested by

no test coverage detected