Code coverage report for 6to5/lib/6to5/generation/position.js

Statements: 100% (15 / 15)      Branches: 100% (4 / 4)      Functions: 100% (3 / 3)      Lines: 100% (15 / 15)      Ignored: none     

All files » 6to5/lib/6to5/generation/ » position.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281   1 12210 12210     1 1926331 12571823 477352 477352   12094471         1 60410 60410 49866   10544        
module.exports = Position;
 
function Position() {
  this.line = 1;
  this.column = 0;
}
 
Position.prototype.push = function (str) {
  for (var i = 0; i < str.length; i++) {
    if (str[i] === "\n") {
      this.line++;
      this.column = 0;
    } else {
      this.column++;
    }
  }
};
 
Position.prototype.unshift = function (str) {
  for (var i = 0; i < str.length; i++) {
    if (str[i] === "\n") {
      this.line--;
    } else {
      this.column--;
    }
  }
};