function cardinalClosed(tension) {
  return function(context) {
    return new CardinalClosed(context, tension);
  };
}

function CardinalClosed(context, tension) {
  this._context = context;
  this._k = (tension == null ? 1 : 1 - tension) / 6;
}

CardinalClosed.prototype = {
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._x6 =
    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = this._y6 = NaN;
    this._state = 0;
  },
  lineEnd: function() {
    switch (this._state) {
      case 1: {
        this._context.moveTo(this._x4, this._y4);
        this._context.closePath();
        break;
      }
      case 2: {
        this._context.lineTo(this._x4, this._y4);
        this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x4, this._y4);
        this.point(this._x5, this._y5);
        this.point(this._x6, this._y6);
        break;
      }
    }
  },
  point: function(x, y) {
    x = +x, y = +y;
    switch (this._state) {
      case 0: this._state = 1; this._x4 = x, this._y4 = y; break;
      case 1: this._state = 2; this._x5 = x, this._y5 = y; this._context.moveTo(x, y); break;
      case 2: this._state = 3; this._x6 = x, this._y6 = y; break;
      default: {
        this._context.bezierCurveTo(
          this._x1 + this._k * (this._x2 - this._x0),
          this._y1 + this._k * (this._y2 - this._y0),
          this._x2 + this._k * (this._x1 - x),
          this._y2 + this._k * (this._y1 - y),
          this._x2,
          this._y2
        );
        break;
      }
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  }
};

export default cardinalClosed;

@@ -365,27 +365,16 @@
 is._x5 =
- this._x6 =
 %0A    thi
@@ -435,27 +435,16 @@
 is._y5 =
- this._y6 =
  NaN;%0A  
@@ -562,33 +562,33 @@
 t.moveTo(this._x
-4
+3
 , this._y4);%0A   
@@ -572,33 +572,33 @@
 his._x3, this._y
-4
+3
 );%0A        this.
@@ -686,33 +686,33 @@
 t.lineTo(this._x
-4
+3
 , this._y4);%0A   
@@ -696,33 +696,33 @@
 his._x3, this._y
-4
+3
 );%0A        this.
@@ -778,24 +778,64 @@
   case 3: %7B%0A
+        this.point(this._x3, this._y3);%0A
         this
@@ -906,48 +906,8 @@
 5);%0A
-        this.point(this._x6, this._y6);%0A
     
@@ -1047,17 +1047,17 @@
  this._x
-4
+3
  = x, th
@@ -1061,17 +1061,17 @@
  this._y
-4
+3
  = y; br
@@ -1113,17 +1113,17 @@
  this._x
-5
+4
  = x, th
@@ -1127,17 +1127,17 @@
  this._y
-5
+4
  = y; th
@@ -1207,17 +1207,17 @@
  this._x
-6
+5
  = x, th
@@ -1221,17 +1221,17 @@
  this._y
-6
+5
  = y; br

Remove unused fields.