{"size": 1913, "ext": "js", "max_stars_repo_path": "embedding/deep/my_django_bokeh_site/djangobokeh/static/js/tree/models/filters/boolean_filter.js", "max_stars_repo_name": "Aquaveo/jupyter_to_tethys", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "embedding/deep/my_django_bokeh_site/djangobokeh/static/js/tree/models/filters/boolean_filter.js", "max_issues_repo_name": "Aquaveo/jupyter_to_tethys", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "embedding/deep/my_django_bokeh_site/djangobokeh/static/js/tree/models/filters/boolean_filter.js", "max_forks_repo_name": "Aquaveo/jupyter_to_tethys", "max_forks_repo_forks_event_min_datetime": "2019-02-12T19:17:54.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-12T19:17:54.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 41.5869565217, "max_line_length": 137, "alphanum_fraction": 0.5943544171}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var filter_1 = require("./filter");
var p = require("core/properties");
var logging_1 = require("core/logging");
var array_1 = require("core/util/array");
var types_1 = require("core/util/types");
var BooleanFilter = /** @class */ (function (_super) {
    tslib_1.__extends(BooleanFilter, _super);
    function BooleanFilter(attrs) {
        return _super.call(this, attrs) || this;
    }
    BooleanFilter.initClass = function () {
        this.prototype.type = 'BooleanFilter';
        this.define({
            booleans: [p.Array, null],
        });
    };
    BooleanFilter.prototype.compute_indices = function (source) {
        var booleans = this.booleans;
        if (booleans != null && booleans.length > 0) {
            if (array_1.all(booleans, types_1.isBoolean)) {
                if (booleans.length !== source.get_length()) {
                    logging_1.logger.warn("BooleanFilter " + this.id + ": length of booleans doesn't match data source");
                }
                return array_1.range(0, booleans.length).filter(function (i) { return booleans[i] === true; });
            }
            else {
                logging_1.logger.warn("BooleanFilter " + this.id + ": booleans should be array of booleans, defaulting to no filtering");
                return null;
            }
        }
        else {
            if (booleans != null && booleans.length == 0)
                logging_1.logger.warn("BooleanFilter " + this.id + ": booleans is empty, defaulting to no filtering");
            else
                logging_1.logger.warn("BooleanFilter " + this.id + ": booleans was not set, defaulting to no filtering");
            return null;
        }
    };
    return BooleanFilter;
}(filter_1.Filter));
exports.BooleanFilter = BooleanFilter;
BooleanFilter.initClass();
