(trackGuidePaths, guidePath, context)
| 100 | // Find the index of a learning track guide path in an array of guide paths, |
| 101 | // return -1 if not found. |
| 102 | async function indexOfLearningTrackGuide(trackGuidePaths, guidePath, context) { |
| 103 | let guideIndex = -1 |
| 104 | |
| 105 | for (let i = 0; i < trackGuidePaths.length; i++) { |
| 106 | // Learning track URLs may have Liquid conditionals. |
| 107 | const renderedGuidePath = await renderContent(trackGuidePaths[i], context, { textOnly: true }) |
| 108 | |
| 109 | if (!renderedGuidePath) continue |
| 110 | |
| 111 | if (renderedGuidePath === guidePath) { |
| 112 | guideIndex = i |
| 113 | break |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | return guideIndex |
| 118 | } |
no test coverage detected