({
block,
challenge,
superBlock
}: ToLearnPathKwargs)
| 11 | * @returns {string} A learning url path. |
| 12 | */ |
| 13 | export 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 | } |
no outgoing calls
no test coverage detected