All files / src margin-of-first-line.ts

100% Statements 8/8
100% Branches 3/3
100% Functions 1/1
100% Lines 7/7

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    24x 14x 14x 16x 6x     14x     24x  
/** @returns whitespace margin (spaces/tabs) for single/first line. */
const marginOfFirstLine =
  (line: string): string => {
    let i = 0
    for (; i < line.length; i++) {
      if (line[i] !== ' ' && line[i] !== '\t') {
        break
      }
    }
    return line.slice(0, i)
  }
 
export default marginOfFirstLine