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

Statements: 100% (18 / 18)      Branches: 100% (4 / 4)      Functions: 100% (5 / 5)      Lines: 100% (18 / 18)      Ignored: none     

All files » 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 28 29 30 31 32 33 341   1   1 264 264     1 17137   17137 52534 2980 2980   49554         1 524   524 524 389   135        
module.exports = Position;
 
var _ = require("lodash");
 
function Position() {
  this.line = 1;
  this.column = 0;
}
 
Position.prototype.push = function (str) {
  var self = this;
 
  _.each(str, function (cha) {
    if (cha === "\n") {
      self.line++;
      self.column = 0;
    } else {
      self.column++;
    }
  });
};
 
Position.prototype.unshift = function (str) {
  var self = this;
 
  _.each(str, function (cha) {
    if (cha === "\n") {
      self.line--;
    } else {
      self.column--;
    }
  });
};