function fixPath(pathInput) {
    var pathArray = parsePathString(pathInput);
    var normalArray = normalizePath(pathArray);
    var length = pathArray.length;
    var isClosed = normalArray.slice(-1)[0][0] === 'Z';
    var segBeforeZ = isClosed ? length - 2 : length - 1;

    var ref = normalArray[0].slice(1);
    var mx = ref[0];
    var my = ref[1];
    var ref$1 = normalArray[segBeforeZ].slice(-2);
    var x = ref$1[0];
    var y = ref$1[1];

    /* istanbul ignore else */
    if (isClosed && mx === x && my === y) {
      return pathArray.slice(0, -1);
    }
    return pathArray;
  }
Checks a `pathArray` for an unnecessary `Z` segment
and returns a new `pathArray` without it.

The `pathInput` must be a single path, without
sub-paths. For multi-path `<path>` elements,
use `splitPath` first and apply this utility on each
sub-path separately.

@param {SVGPath.pathArray | string} pathInput the `pathArray` source
@return {SVGPath.pathArray} a fixed `pathArray`