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

Function createEmptySteps

tools/challenge-helper-scripts/commands.ts:72–86  ·  view source on GitHub ↗
(num: number)

Source from the content-addressed store, hash-verified

70}
71
72async function createEmptySteps(num: number): Promise<void> {
73 if (num < 1 || num > 1000) {
74 throw Error(
75 `No steps created. arg 'num' must be between 1 and 1000 inclusive`
76 );
77 }
78
79 const nextStepNum = getMetaData().challengeOrder.length + 1;
80 for (let stepNum = nextStepNum; stepNum < nextStepNum + num; stepNum++) {
81 const challengeId = new ObjectId();
82 createStepFile({ stepNum, challengeId });
83 await insertStepIntoMeta({ stepNum, stepId: challengeId });
84 }
85 console.log(`Successfully added ${num} steps`);
86}
87
88export { deleteStep, insertStep, createEmptySteps };

Callers 1

Calls 3

getMetaDataFunction · 0.85
createStepFileFunction · 0.85
insertStepIntoMetaFunction · 0.85

Tested by

no test coverage detected