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

Function toLearnPath

client/src/utils/to-learn-path.ts:13–28  ·  view source on GitHub ↗
({
  block,
  challenge,
  superBlock
}: ToLearnPathKwargs)

Source from the content-addressed store, hash-verified

11 * @returns {string} A learning url path.
12 */
13export default function toLearnPath({
14 block,
15 challenge,
16 superBlock
17}: ToLearnPathKwargs): string {
18 // Match path order /:super-block/:block/:challenge
19 const folders = [superBlock, block, challenge];
20
21 return folders.reduce((path: string, folder) => {
22 if (folder) {
23 return `${path}/${folder}`;
24 }
25
26 return path;
27 }, '/learn');
28}

Callers 2

ChallengesRedirectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected