19 lines
407 B
TypeScript
19 lines
407 B
TypeScript
import { DiffLine } from "../..";
|
|
|
|
export function getRenderableDiff(diffLines: DiffLine[]) {
|
|
let diffLineNumberStart = -1;
|
|
const diff = diffLines
|
|
.reduce((acc, curr, i) => {
|
|
if (curr.type === "new") {
|
|
acc += `${curr.line}\n`;
|
|
|
|
if (diffLineNumberStart === -1) {
|
|
diffLineNumberStart = i;
|
|
}
|
|
}
|
|
return acc;
|
|
}, "")
|
|
.slice(2);
|
|
|
|
return diff;
|
|
}
|