code: function calcMinimumBounds(lines) {
      var bounds = {  x:  Number.MAX_VALUE, y:  Number.MAX_VALUE,  x2: Number.MIN_VALUE, y2: Number.MIN_VALUE }
      function checkPoint(pt) {
          bounds.x  = Math.min(bounds.x,pt.x);
          bounds.y  = Math.min(bounds.y,pt.y);
          bounds.x2 = Math.max(bounds.x2,pt.x);
          bounds.y2 = Math.max(bounds.y2,pt.y);
      }
      lines.forEach(function(line) {
          checkPoint(line.start);
          checkPoint(line.end);
      })
      return bounds;
  }
docs: Calculate Minimum Bounds
  
  @param {Array} lines
  
  @ignore
  
  @returns {{x: Number.MAX_VALUE, y: Number.MAX_VALUE, x2: Number.MIN_VALUE, y2: Number.MIN_VALUE}}