index.js
function detectZoomRanges(zooms) {
    var ranges = [];
    var currentRange = [];
    for (var i = 0, z = zooms[0]; i <= zooms.length; i++, z = zooms[i]) {
        if (currentRange.length < 2) {
            currentRange.push(z);
            continue;
        }
        if (currentRange.length === 2) {
            if (z === currentRange[1] + 1) {
                currentRange[1] = z;
            } else {
                ranges.push(currentRange);
                currentRange = [];
            }
        }
    }
    if (currentRange.length > 0) {
        ranges.push(currentRange);
    }
    return ranges;
}
function detectZoomRanges(zooms) {
    var ranges = [];
    var currentRange = [];
    for (var i = 0, z = zooms[0]; i <= zooms.length; i++, z = zooms[i]) {
        if (currentRange.length < 2) {
            currentRange.push(z);
            continue;
        }
        if (currentRange.length === 2) {
            if (z === currentRange[1] + 1) {
                currentRange[1] = z;
            } else {
                ranges.push(currentRange);
                currentRange = [];
            }
        }
    }
    if (currentRange.length > 0) {
        ranges.push(currentRange);
    }
    return ranges;
}
function detectZoomRanges ( zooms ) { var ranges = [ ] ; var currentRange = [ ] ; for ( var i = 0 , z = zooms [ 0 ] ; i <= zooms . length ; i ++ , z = zooms [ i ] ) { if ( currentRange . length < 2 ) { currentRange . push ( z ) ; continue ; } if ( currentRange . length === 2 ) { if ( z === currentRange [ 1 ] + 1 ) { currentRange [ 1 ] = z ; } else { ranges . push ( currentRange ) ; currentRange = [ ] ; } } } if ( currentRange . length > 0 ) { ranges . push ( currentRange ) ; } return ranges ; }
Find zoom ranges in a set of zooms
Find zoom ranges in a set of zooms