branch.js 588 B

12345678910111213141516171819202122232425262728
  1. module.exports = class CovBranch {
  2. constructor (startLine, startCol, endLine, endCol, count) {
  3. this.startLine = startLine
  4. this.startCol = startCol
  5. this.endLine = endLine
  6. this.endCol = endCol
  7. this.count = count
  8. }
  9. toIstanbul () {
  10. const location = {
  11. start: {
  12. line: this.startLine,
  13. column: this.startCol
  14. },
  15. end: {
  16. line: this.endLine,
  17. column: this.endCol
  18. }
  19. }
  20. return {
  21. type: 'branch',
  22. line: this.startLine,
  23. loc: location,
  24. locations: [Object.assign({}, location)]
  25. }
  26. }
  27. }