function.js
 1  module.exports = class CovFunction {
 2    constructor (name, startLine, startCol, endLine, endCol, count) {
 3      this.name = name
 4      this.startLine = startLine
 5      this.startCol = startCol
 6      this.endLine = endLine
 7      this.endCol = endCol
 8      this.count = count
 9    }
10  
11    toIstanbul () {
12      const loc = {
13        start: {
14          line: this.startLine,
15          column: this.startCol
16        },
17        end: {
18          line: this.endLine,
19          column: this.endCol
20        }
21      }
22      return {
23        name: this.name,
24        decl: loc,
25        loc: loc,
26        line: this.startLine
27      }
28    }
29  }