function $39ac1d12ee446570$var$combineRanges(ranges) {
    var ordered = ranges.map($39ac1d12ee446570$var$mapWithIndex).sort($39ac1d12ee446570$var$sortByRangeStart);
    for(var j = 0, i = 1; i < ordered.length; i++){
        var range = ordered[i];
        var current = ordered[j];
        if (range.start > current.end + 1) // next range
        ordered[++j] = range;
        else if (range.end > current.end) {
            // extend range
            current.end = range.end;
            current.index = Math.min(current.index, range.index);
        }
    }
    // trim ordered array
    ordered.length = j + 1;
    // generate combined range
    var combined = ordered.sort($39ac1d12ee446570$var$sortByRangeIndex).map($39ac1d12ee446570$var$mapWithoutIndex);
    // copy ranges type
    combined.type = ranges.type;
    return combined;
}
/**
 * Combine overlapping & adjacent ranges.
 * @private
 */
Combine overlapping & adjacent ranges.
@private
Combine overlapping & adjacent ranges . @private
function $39ac1d12ee446570$var$combineRanges(ranges) {
    var ordered = ranges.map($39ac1d12ee446570$var$mapWithIndex).sort($39ac1d12ee446570$var$sortByRangeStart);
    for(var j = 0, i = 1; i < ordered.length; i++){
        var range = ordered[i];
        var current = ordered[j];
        if (range.start > current.end + 1) 
        ordered[++j] = range;
        else if (range.end > current.end) {
            current.end = range.end;
            current.index = Math.min(current.index, range.index);
        }
    }
    ordered.length = j + 1;
    var combined = ordered.sort($39ac1d12ee446570$var$sortByRangeIndex).map($39ac1d12ee446570$var$mapWithoutIndex);
    combined.type = ranges.type;
    return combined;
}
function $39ac1d12ee446570$var$combineRanges ( ranges ) { var ordered = ranges . map ( $39ac1d12ee446570$var$mapWithIndex ) . sort ( $39ac1d12ee446570$var$sortByRangeStart ) ; for ( var j = 0 , i = 1 ; i < ordered . length ; i ++ ) { var range = ordered [ i ] ; var current = ordered [ j ] ; if ( range . start > current . end + 1 ) ordered [ ++ j ] = range ; else if ( range . end > current . end ) { current . end = range . end ; current . index = Math . min ( current . index , range . index ) ; } } ordered . length = j + 1 ; var combined = ordered . sort ( $39ac1d12ee446570$var$sortByRangeIndex ) . map ( $39ac1d12ee446570$var$mapWithoutIndex ) ; combined . type = ranges . type ; return combined ; }
Combine overlapping & adjacent ranges.
Combine overlapping & adjacent ranges .
// next range // extend range // trim ordered array // generate combined range // copy ranges type