(suffix)
| 188 | // finds one string replacement that yields either a page or a redirect. |
| 189 | function tryReplacements(prefix, suffix, { pages, redirects }) { |
| 190 | const test = (suffix) => { |
| 191 | // This is a generally broad search and replace and this particular |
| 192 | // replacement has never been present in api documentation only enterprise |
| 193 | // admin documentation, so we're excluding the REST api pages |
| 194 | if (suffix.includes('/rest')) { |
| 195 | return false |
| 196 | } |
| 197 | const candidateAsRedirect = prefix + suffix |
| 198 | const candidateAsURL = '/en' + candidateAsRedirect |
| 199 | return candidateAsRedirect in redirects || candidateAsURL in pages |
| 200 | } |
| 201 | |
| 202 | let attempt = suffix.replace('/user', '/github') |
| 203 | if (test(attempt)) return attempt |
no outgoing calls
no test coverage detected