2019-04-04 13:08:34 +00:00
|
|
|
function trimFirstCharOfLineContent(text) {
|
|
|
|
if (!text) {
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
return text.replace(/^( |\+|-)/, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
function cleanSuggestionLine(line = {}) {
|
|
|
|
return {
|
|
|
|
...line,
|
|
|
|
text: trimFirstCharOfLineContent(line.text),
|
2019-12-24 09:07:44 +00:00
|
|
|
rich_text: trimFirstCharOfLineContent(line.rich_text),
|
2019-04-04 13:08:34 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function selectDiffLines(lines) {
|
|
|
|
return lines.filter(line => line.type !== 'match').map(line => cleanSuggestionLine(line));
|
|
|
|
}
|