MCPcopy Index your code
hub / github.com/github/docs / changeLearningTracks

Function changeLearningTracks

script/move-content.js:549–556  ·  view source on GitHub ↗
(filePath, oldHref, newHref)

Source from the content-addressed store, hash-verified

547}
548
549function changeLearningTracks(filePath, oldHref, newHref) {
550 // Can't deserialize and serialize the Yaml because it would lose
551 // formatting and comments. So regex replace it.
552 const regex = new RegExp(`- ${oldHref}$`, 'gm')
553 const oldContent = fs.readFileSync(filePath, 'utf-8')
554 const newContent = oldContent.replace(regex, `- ${newHref}`)
555 fs.writeFileSync(filePath, newContent, 'utf-8')
556}

Callers 2

editFilesFunction · 0.85
undoFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected