| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 793fee4 commit b1b6f20
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,16 +64,19 @@ async function getCollaboratorsFromReadme() { | |||
| 64 | 64 | crlfDelay: Infinity, | |
| 65 | 65 | }); | |
| 66 | 66 | const returnedArray = []; | |
| 67 | - let processingCollaborators = false; | ||
| 67 | + let foundCollaboratorHeading = false; | ||
| 68 | 68 | for await (const line of readmeText) { | |
| 69 | - const isCollaborator = processingCollaborators && line.length; | ||
| 70 | - if (line === '### Collaborators') { | ||
| 71 | - processingCollaborators = true; | ||
| 72 | - } | ||
| 73 | - if (line === '### Collaborator emeriti') { | ||
| 74 | - processingCollaborators = false; | ||
| 69 | + // If we've found the collaborator heading already, stop processing at the | ||
| 70 | + // next heading. | ||
| 71 | + if (foundCollaboratorHeading && line.startsWith('#')) { | ||
| 75 | 72 | break; | |
| 76 | 73 | } | |
| 74 | + | ||
| 75 | + const isCollaborator = foundCollaboratorHeading && line.length; | ||
| 76 | + | ||
| 77 | + if (line === '### Collaborators') { | ||
| 78 | + foundCollaboratorHeading = true; | ||
| 79 | + } | ||
| 77 | 80 | if (line.startsWith('**') && isCollaborator) { | |
| 78 | 81 | const [, name, email] = /^\*\*([^*]+)\*\* <(.+)>/.exec(line); | |
| 79 | 82 | const mailmap = await runGitCommand( | |
@@ -89,6 +92,11 @@ async function getCollaboratorsFromReadme() { | |||
| 89 | 92 | }); | |
| 90 | 93 | } | |
| 91 | 94 | } | |
| 95 | + | ||
| 96 | + if (!foundCollaboratorHeading) { | ||
| 97 | + throw new Error('Could not find Collaborator section of README'); | ||
| 98 | + } | ||
| 99 | + | ||
| 92 | 100 | return returnedArray; | |
| 93 | 101 | } | |
| 94 | 102 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments