MCPcopy Index your code
hub / github.com/bigcode-project/jupytercoder / parseFileHeader

Function parseFileHeader

src/diff.js:610–626  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

608
609
610 function parseFileHeader(index) {
611 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
612
613 if (fileHeader) {
614 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
615 var data = fileHeader[2].split('\t', 2);
616 var fileName = data[0].replace(/\\\\/g, '\\');
617
618 if (/^".*"$/.test(fileName)) {
619 fileName = fileName.substr(1, fileName.length - 2);
620 }
621
622 index[keyPrefix + 'FileName'] = fileName;
623 index[keyPrefix + 'Header'] = (data[1] || '').trim();
624 i++;
625 }
626 } // Parses a hunk
627 // This assumes that we are at the start of a hunk.
628
629

Callers 1

parseIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected