All files / app/assets/javascripts/vue_shared/components/lib/utils diff_utils.js

85.71% Statements 6/7
33.33% Branches 1/3
100% Functions 5/5
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  42x       42x       21x               21x    
function trimFirstCharOfLineContent(text) {
  Iif (!text) {
    return text;
  }
 
  return text.replace(/^( |\+|-)/, '');
}
 
function cleanSuggestionLine(line = {}) {
  return {
    ...line,
    text: trimFirstCharOfLineContent(line.text),
    rich_text: trimFirstCharOfLineContent(line.rich_text),
  };
}
 
export function selectDiffLines(lines) {
  return lines.filter((line) => line.type !== 'match').map((line) => cleanSuggestionLine(line));
}