code: function(arg) {
  
              var segments = this.segments;
              var numSegments = segments.length;
              // works even if path has no segments
  
              var currentSegment;
  
              var previousSegment = ((numSegments !== 0) ? segments[numSegments - 1] : null); // if we are appending to an empty path, previousSegment is null
              var nextSegment = null;
  
              if (!Array.isArray(arg)) { // arg is a segment
                  if (!arg || !arg.isSegment) throw new Error('Segment required.');
  
                  currentSegment = this.prepareSegment(arg, previousSegment, nextSegment);
                  segments.push(currentSegment);
  
              } else { // arg is an array of segments
                  if (!arg[0].isSegment) throw new Error('Segments required.');
  
                  var n = arg.length;
                  for (var i = 0; i < n; i++) {
  
                      var currentArg = arg[i];
                      currentSegment = this.prepareSegment(currentArg, previousSegment, nextSegment);
                      segments.push(currentSegment);
                      previousSegment = currentSegment;
                  }
              }
          }
docs: Accepts one segment or an array of segments as argument. Throws an error if argument is not a segment or an array of segments.