index.js
function zoomCondition(zoom) {
    var zooms = [];
    for (var i = 0; i <= _carto2['default'].tree.Zoom.maxZoom; i++) {
        if (zoom & 1 << i) {
            zooms.push(i);
        }
    }

    var zoomRanges = detectZoomRanges(zooms),
        value,
        operator;
    if (zoomRanges.length > 1) {
        operator = 'IN';
        value = zooms;
    } else {
        var range = zoomRanges[0];
        if (range[0] === 0) {
            operator = '<=';
            value = range[1];
        } else if (range[1] === _carto2['default'].tree.Zoom.maxZoom) {
            operator = '>=';
            value = range[0];
        } else {
            // We're only handling >=, <= and IN right now
            operator = 'IN';
            value = zooms;
        }
    }

    if (value.length === 0) {
        return null;
    }
    return [{
        operator: operator,
        type: 'zoom',
        value: value
    }];
}
function zoomCondition(zoom) {
    var zooms = [];
    for (var i = 0; i <= _carto2['default'].tree.Zoom.maxZoom; i++) {
        if (zoom & 1 << i) {
            zooms.push(i);
        }
    }

    var zoomRanges = detectZoomRanges(zooms),
        value,
        operator;
    if (zoomRanges.length > 1) {
        operator = 'IN';
        value = zooms;
    } else {
        var range = zoomRanges[0];
        if (range[0] === 0) {
            operator = '<=';
            value = range[1];
        } else if (range[1] === _carto2['default'].tree.Zoom.maxZoom) {
            operator = '>=';
            value = range[0];
        } else {
            // We're only handling >=, <= and IN right now
            operator = 'IN';
            value = zooms;
        }
    }

    if (value.length === 0) {
        return null;
    }
    return [{
        operator: operator,
        type: 'zoom',
        value: value
    }];
}
function zoomCondition ( zoom ) { var zooms = [ ] ; for ( var i = 0 ; i <= _carto2 [ 'default' ] . tree . Zoom . maxZoom ; i ++ ) { if ( zoom & 1 << i ) { zooms . push ( i ) ; } } var zoomRanges = detectZoomRanges ( zooms ) , value , operator ; if ( zoomRanges . length > 1 ) { operator = 'IN' ; value = zooms ; } else { var range = zoomRanges [ 0 ] ; if ( range [ 0 ] === 0 ) { operator = '<=' ; value = range [ 1 ] ; } else if ( range [ 1 ] === _carto2 [ 'default' ] . tree . Zoom . maxZoom ) { operator = '>=' ; value = range [ 0 ] ; } else { // We're only handling >=, <= and IN right now operator = 'IN' ; value = zooms ; } } if ( value . length === 0 ) { return null ; } return [ { operator : operator , type : 'zoom' , value : value } ] ; }
Create a zoom condition given a zoom integer
Create a zoom condition given a zoom integer