code: function(index) {
  
              var segments = this.segments;
              var numSegments = segments.length;
              if (numSegments === 0) throw new Error('Path has no segments.');
  
              if (index < 0) index = numSegments + index; // convert negative indices to positive
              if (index >= numSegments || index < 0) throw new Error('Index out of range.');
  
              var removedSegment = segments.splice(index, 1)[0];
              var previousSegment = removedSegment.previousSegment;
              var nextSegment = removedSegment.nextSegment;
  
              // link the previous and next segments together (if present)
              if (previousSegment) previousSegment.nextSegment = nextSegment; // may be null
              if (nextSegment) nextSegment.previousSegment = previousSegment; // may be null
  
              // if removed segment used to start a subpath, update all subsequent segments until another subpath start segment is reached
              if (removedSegment.isSubpathStart && nextSegment) this.updateSubpathStartSegment(nextSegment);
          }
docs: Remove the segment at `index`. Accepts negative indices, from `-1` to `-segments.length`. Throws an error if path has no segments. Throws an error if index is out of range.