remove unnecessary slice
This commit is contained in:
parent
d44c53329b
commit
69f3a54097
1 changed files with 8 additions and 10 deletions
|
|
@ -2,18 +2,16 @@ 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`;
|
||||
const diff = diffLines.reduce((acc, curr, i) => {
|
||||
if (curr.type === "new") {
|
||||
acc += `${curr.line}\n`;
|
||||
|
||||
if (diffLineNumberStart === -1) {
|
||||
diffLineNumberStart = i;
|
||||
}
|
||||
if (diffLineNumberStart === -1) {
|
||||
diffLineNumberStart = i;
|
||||
}
|
||||
return acc;
|
||||
}, "")
|
||||
.slice(2);
|
||||
}
|
||||
return acc;
|
||||
}, "");
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue