MCPcopy Index your code
hub / github.com/nodejs/node / getVersionsFromFile

Function getVersionsFromFile

tools/lint-md/list-released-versions-from-changelogs.mjs:9–27  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

7
8const result = [];
9async function getVersionsFromFile(file) {
10 const input = fs.createReadStream(file);
11 let toc = false;
12 for await (const line of createInterface({
13 input,
14 crlfDelay: Infinity,
15 })) {
16 if (toc === false && line === '<table>') {
17 toc = true;
18 } else if (toc && line[0] !== '<') {
19 input.close();
20 return;
21 } else if (toc && line.startsWith('<a')) {
22 result.push(line.slice(line.indexOf('>') + 1, -'</a><br/>'.length));
23 } else if (toc && line.startsWith('<b><a')) {
24 result.push(line.slice(line.indexOf('>', 3) + 1, -'</a></b><br/>'.length));
25 }
26 }
27}
28
29const filesToCheck = [];
30

Calls 6

closeMethod · 0.65
sliceMethod · 0.65
createInterfaceFunction · 0.50
createReadStreamMethod · 0.45
pushMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected