code: function(segment) {
  
              var previousSegment = segment.previousSegment; // may be null
              while (segment && !segment.isSubpathStart) {
  
                  // assign previous segment's subpath start segment to this segment
                  if (previousSegment) segment.subpathStartSegment = previousSegment.subpathStartSegment; // may be null
                  else segment.subpathStartSegment = null; // if segment had no previous segment, assign null - creates an invalid path!
  
                  previousSegment = segment;
                  segment = segment.nextSegment; // move on to the segment after etc.
              }
          }
docs: Helper method for updating subpath start of segments, starting with the one provided.