Compute the filters to use in the html-pipeline based on the given options
429947
def pipeline_filters(options)
      filters = [
          HTML::Pipeline::MarkdownFilter,
          HTML::Pipeline::SanitizationFilter,
          HTML::Pipeline::ImageMaxWidthFilter,
          HTML::Pipeline::HttpsFilter,
          HTML::Pipeline::EmojiFilter,
          GithubMarkdownPreview::Pipeline::TaskListFilter
      ]

      if HtmlPreview::SYNTAX_HIGHLIGHTS
        filters << HTML::Pipeline::SyntaxHighlightFilter
      end

      if options[:comment_mode]
        filters << HTML::Pipeline::MentionFilter
      else
        filters << HTML::Pipeline::TableOfContentsFilter
      end

      filters
    end
461661
function buildFilters(filters) {
    var builtFilters = [];
    filters.forEach(function(filter) {
      builtFilters.push(MongoDatabase.buildFilter(filter));
    });
    return builtFilters;
  }
758024
def get_filter_options(cls):
        
        attr = '_filter_options_%s' % id(cls)

        options = getattr(cls, attr, {})
        if options:
            return options

        for key in dir(cls):
            val = getattr(cls, key)
            if isinstance(val, FilterOpt):
                options[key] = val

        setattr(cls, attr, options)
        return options
1289166
private function findByFiltersIds($filters, $page, $pageSize, $limit, $locale, $options = [])
    {
        $parameter = [];

        $queryBuilder = $this->createQueryBuilder('c')
            ->select('c.id')
            ->distinct()
            ->orderBy('c.id', 'ASC');

        $tagRelation = $this->appendTagsRelation($queryBuilder, 'c');
        $categoryRelation = $this->appendCategoriesRelation($queryBuilder, 'c');

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $queryBuilder, 'c', $locale);

            foreach ($filters['sortBy'] as $sortColumn) {
                $queryBuilder->addSelect($sortColumn);
            }
        }

        $parameter = array_merge($parameter, $this->append($queryBuilder, 'c', $locale, $options));
        if (isset($filters['dataSource'])) {
            $includeSubFolders = $this->getBoolean($filters['includeSubFolders'] ?: false);
            $parameter = array_merge(
                $parameter,
                $this->appendDatasource($filters['dataSource'], $includeSubFolders, $queryBuilder, 'c')
            );
        }

        if (isset($filters['tags']) && !empty($filters['tags'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $tagRelation,
                    $filters['tags'],
                    strtolower($filters['tagOperator']),
                    'adminTags'
                )
            );
        }

        if (isset($filters['categories']) && !empty($filters['categories'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $categoryRelation,
                    $filters['categories'],
                    strtolower($filters['categoryOperator']),
                    'adminCategories'
                )
            );
        }

        if (isset($filters['targetGroupId']) && $filters['targetGroupId']) {
            $targetGroupRelation = $this->appendTargetGroupRelation($queryBuilder, 'c');
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $targetGroupRelation,
                    [$filters['targetGroupId']],
                    'and',
                    'targetGroupId'
                )
            );
        }

        if (isset($filters['websiteTags']) && !empty($filters['websiteTags'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $tagRelation,
                    $filters['websiteTags'],
                    strtolower($filters['websiteTagsOperator']),
                    'websiteTags'
                )
            );
        }

        if (isset($filters['websiteCategories']) && !empty($filters['websiteCategories'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $categoryRelation,
                    $filters['websiteCategories'],
                    strtolower($filters['websiteCategoriesOperator']),
                    'websiteCategories'
                )
            );
        }

        $query = $queryBuilder->getQuery();
        foreach ($parameter as $name => $value) {
            $query->setParameter($name, $value);
        }

        if (null !== $page && $pageSize > 0) {
            $pageOffset = ($page - 1) * $pageSize;
            $restLimit = $limit - $pageOffset;

            // if limitation is smaller than the page size then use the rest limit else use page size plus 1 to
            // determine has next page
            $maxResults = (null !== $limit && $pageSize > $restLimit ? $restLimit : ($pageSize + 1));

            if ($maxResults <= 0) {
                return [];
            }

            $query->setMaxResults($maxResults);
            $query->setFirstResult($pageOffset);
        } elseif (null !== $limit) {
            $query->setMaxResults($limit);
        }

        return array_map(
            function($item) {
                return $item['id'];
            },
            $query->getScalarResult()
        );
    }
84179
function( node, options ) {
			var classes,
				i;

			if(!node){
				return false;
			}

			// if documemt gets topmost node
			node = modules.domUtils.getTopMostNode( node );

			// look for h-* microformats
			classes = this.getUfClassNames(node);
			if(options && options.filters && modules.utils.isArray(options.filters)){
				i = options.filters.length;
				while(i--) {
					if(classes.root.indexOf(options.filters[i]) > -1){
						return true;
					}
				}
				return false;
			}else{
				return (classes.root.length > 0);
			}
		}
1249145
private void decideTypeFilterToAdd(Filter filter) {
        Filter step = filter;

        if (Operator.MATCH == step.getRelation().getOperator() ||
                step.getRelation().getRightTerm() instanceof FunctionSelector) {
            if (matchList.isEmpty()) {
                matchList = new ArrayList<>();
            }
            matchList.add(filter);
        } else {
            if (filterList.isEmpty()) {
                filterList = new ArrayList<>();
            }
            filterList.add(filter);
        }
    }
888366
function combineFilterFirstValues(options) {
	return function(inSet, gt) {
		var values = inSet.values.filter(function(value) {
			return options.values.test(value, gt.value);
		});
		var range = options.with ? new options.with(gt.value) : gt;
		return values.length ?
			options.combinedUsing([new options.arePut(values), range]) : range;
	};
}
1326441
def datagrid_filter(filter_or_attribute, options = {}, &block)
      filter = datagrid_get_filter(filter_or_attribute)
      options = add_html_classes(options, filter.name, datagrid_filter_html_class(filter))
      # Prevent partials option from appearing in HTML attributes
      options.delete(:partials) # Legacy option
      self.send(filter.form_builder_helper_name, filter, options, &block)
    end
444892
function htmlLoaderOptions(options) {
  return {
    loader: 'html-loader',
    options: Object.assign({}, options, {
      minimize: options.env === 'development' ? false : true
    })
  }
}
1339925
def filter_element(data)
      if @element_filter
        data, el_errors = @element_filter.filter(data)
        return [data, el_errors] if el_errors
      elsif options[:class]
        if !data.is_a?(options[:class])
          return [data, :class]
        end
      end

      [data, nil]
    end
916839
def select_filters(target, options)
      found = filters_store.fetch(options, [])
      if
        Hash === options || options.nil?
      then
        options ||={}
        options.merge!(:target => target)
        found +=
        # can not @filters.fetch(options, []) to allow filters provide custom ==()
        filters_store.select do |filter_options, filters|
          options == filter_options
        end.map(&:last).flatten
      end
      found
    end
1019853
function filter (arrayToFilter, options) {
  // conditions
  const nameFilter = (senador, nombre) => {
    assert(typeof nombre === 'string' || nombre instanceof RegExp, 'El nombre solo se puede filtrar por string o expresion regular')

    return typeof nombre === 'string' ? wrapString(senador.nombre).indexOf(wrapString(nombre)) > -1 : nombre.test(senador.nombre)
  }
  const rutFilter = (senador, rut) => {
    assert(validate(rut), 'el rut de busqueda ingresado no es valido')

    return wrapString(senador.rut) === wrapString(rut)
  }
  const defualtRutFilter = (senador, rut) => {
    rut = rut.toString()

    return senador.rut.split('-')[0] === rut
  }
  const regionFilter = (senador, region) => {
    assert(typeof region === 'string' || region instanceof RegExp, 'La region solo se puede filtrar por string o expresion regular')

    return typeof region === 'string' ? wrapString(senador.region).indexOf(wrapString(region)) > -1 : region.test(senador.region)
  }
  const circunscripcionFilter = (senador, circunscripcion) => {
    assert.equal(typeof circunscripcion, 'number', 'La circunscripción ingresada para buscar debe ser un número')

    return senador.circunscripcion === circunscripcion
  }
  const telefonoFilter = (senador, telefono) => {
    assert(typeof telefono === 'string' || telefono instanceof RegExp, 'El telefono solo se puede filtrar por string o expresion regular')

    return typeof telefono === 'string' ? wrapString(senador.telefono).indexOf(wrapString(telefono)) > -1 : telefono.test(senador.telefono)
  }
  const mailFilter = (senador, mail) => {
    assert(typeof mail === 'string' || mail instanceof RegExp, 'El telefono solo se puede filtrar por string o expresion regular')

    return typeof mail === 'string' ? wrapString(senador.mail).indexOf(wrapString(mail)) > -1 : mail.test(senador.mail)
  }
  const partidoFilter = (senador, partido) => {
    assert(typeof partido === 'string' || partido instanceof RegExp, 'El telefono solo se puede filtrar por string o expresion regular')

    return typeof partido === 'string' ? wrapString(senador.partido).indexOf(wrapString(partido)) > -1 : partido.test(senador.partido)
  }

  const _filter = elem => {
    if (elem.hasOwnProperty('senador')) elem = elem.senador
    // default queries
    if (typeof options === 'string' && elem) return nameFilter(elem, options)
    if (typeof options === 'number' && elem) return defualtRutFilter(elem, options)

    return (options.nombre ? nameFilter(elem, options.nombre) : true) &&
           (options.rut ? rutFilter(elem, options.rut) : true) &&
           (options.region ? regionFilter(elem, options.region) : true) &&
           (options.circunscripcion ? circunscripcionFilter(elem, options.circunscripcion) : true) &&
           (options.telefono ? telefonoFilter(elem, options.telefono) : true) &&
           (options.mail ? mailFilter(elem, options.mail) : true) &&
           (options.partido ? partidoFilter(elem, options.partido) : true)
  }
  return arrayToFilter.filter(_filter)
}
485409
function _applyFilters(rawdata, filterOptions) {
			var dataToWorkOn = (JSON.parse(JSON.stringify(rawdata)));
			var containerWidth = document.querySelector('#sapUiSupportPerfHeaderTimeline').offsetWidth - document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').offsetWidth;
			var scrollWidth = 20;
			var filteredTime = 1;

			dataToWorkOn = _filterByTime(filterOptions.filterByTime, dataToWorkOn);
			dataToWorkOn = _sortBy(filterOptions.orderByValue, dataToWorkOn);
			dataToWorkOn = _filterMinValue(filterOptions.minValue, dataToWorkOn);

			if (dataToWorkOn.length) {
				filteredTime = filterOptions.filterByTime.end - filterOptions.filterByTime.start;
			}

			_widthSingleUnit = ((containerWidth - scrollWidth) / filteredTime); //ms in px

			return dataToWorkOn;
		}
218011
def and_filter_from_opts(opts):
    ''''''
    return filters.and_filter(*list(chain.from_iterable([
        o for o in opts.values() if o]
    )))
1328134
function getFilteredParamInfo(flapjack, options) {
    if (!flapjack) { return {}; }

    var aliases = this.getClientAliases(flapjack, options);
    var params = this.getParameters(flapjack) || [];
    params = params.filter(function (param) {
        return ['$scope', 'defaults', 'initialModel'].indexOf(param) < 0;
    });

    return this.getParamInfo(params, aliases) || {};
}
209728
def filter!(type, base = settings)
      filter! type, base.superclass if base.superclass.respond_to?(:filters)
      base.filters[type].each { |args| process_route(*args) }
    end
218885
function exportFilter(feed,filter,filterName) {

	var optionCount = 0;

	var s = '/**\n';
	s += '* '+filter.title+'\n';
	if (filter.href) {
		if (!checkHref(filter.href,filter.name)) {
			console.log('! filter '+filterName+'('+filter.name+') does not appear in');
			console.log('  '+filter.href);
		}
		s += '* '+filter.href+'\n';
	}
	if (filter.type) {
		s += '* type = '+filter.type+'\n';
	}
	if (filter.default) {
		s += '* default = '+filter.default+'\n';
	}
	if (filter.multiple_values) {
		s += '* multiple_values = '+filter.multiple_values+'\n';
	}
	if (filter.min_value) {
		s += '* min_value = '+filter.min_value+'\n';
	}
	if (filter.max_value) {
		s += '* max_value = '+filter.max_value+'\n';
	}
	if (filter.depends_on) {
		s += '* depends_on = '+filter.depends_on+'\n';
	}
	if (filter.prefer) {
		s += '* prefer = '+filter.prefer+'\n';
	}
	if (filter.prohibits) {
		s += prohibits(filter.prohibits);
	}
	if (filter.affected_by) {
		if (filter.affected_by.filter) {
			for (var i=0;i<filter.affected_by.filter.length;i++) {
				s += '* is affected by filter '+filter.affected_by.filter[i].name+' ('+filter.affected_by.filter[i].description+')\n';
			}
		}
	}

	if (filter.option) {
		filter.option = toArray(filter.option);
		for (var i in filter.option) {
			var option = filter.option[i];
			if (option.title) {
				s += '* option: '+option.value+', '+option.title+'\n';
				s += '*/\n';
				var optionName = filterName+('-'+option.value).toCamelCase();
				cache.push(optionName+' : '+optionName +',\n');
				fs.appendFileSync(apijs, s+'const '+optionName+" = '"+filter.name+'='+encodeURIComponent(option.value)+"';\n", 'utf8');
				s = '/**\n';
				seen.push(optionName);
				//optionCount++;
			}
			if (option.href) {
				s += '* '+option.href+'\n';
				if (!checkHref(option.href,option.value)) {
					console.log('! option '+filterName+'('+option.value+') does not exist in');
					console.log('  '+option.href);
				}
			}

			var param = {};
			for (var p in params) {
				if (params[p].name == filter.name) {
					param = params[p];
				}
			}
			if (!param.name) {
				param.name = filter.name;
				param.in = 'query';
				param.description = filter.title;
				param.schema = {};
				param.schema.type = 'array';
				//param.collectionFormat = 'multi';
				param.schema.items = {};
				param.schema.items.type = 'string';
				param.required = false;
				param.schema.items.enum = [];
				params.push(param);
			}
			param.schema.items.enum.push(option.value);

			// TODO unstable filters

		}
	}
	s += '*/\n';
	fs.appendFileSync(apijs, s+'const '+filterName+" = '"+filter.name+"';\n", 'utf8');
	cache.push(filterName + ' : '+filterName +',\n');

	if (optionCount<1) {
		var param = {};
		for (var p in params) {
			if (params[p].name == filter.name) {
				param = params[p];
			}
		}
		if (!param.name) {
			param.name = filter.name;
			param.in = 'query';
			param.description = filter.title;
			param.schema = {};
			param.schema.type = filter.type;
			if (filter.type == 'PID') {
				param.schema.type = 'string';
				param.schema.minLength = 8;
				param.schema.pattern = "^([0-9,a-d,f-h,j-n,p-t,v-z]){8,}$";
			}
			if (filter.type == 'ID') {
				param.schema.type = 'string';
			}
			if (filter.type == 'datetime') {
				param.schema.type = 'string';
				param.schema.format = 'date-time';
			}
			if (filter.type == 'date') {
				param.schema.type = 'string';
				param.schema.format = 'date';
			}
			if (filter.type == 'character') {
				param.schema.type = 'string';
				param.schema.minLength = 1;
				param.schema.maxLength = 1;
			}
			if (filter.default) {
				param.schema.default = filter.default;
				if (param.schema.type == 'integer') {
					param.schema.default = parseInt(filter.default,10);
				}
			}
			if (filter.min_value) {
				param.schema.minimum = filter.min_value;
			}
			if (filter.max_value) {
				param.schema.maximum = filter.max_value;
			}
			if (filter.multiple_values === true) {
				param.schema.items = {};
				param.schema.items.type = param.schema.type;
				param.schema.type = 'array';
				//param.collectionFormat = 'multi';
				if (param.schema.default) {
					param.schema.items.default = param.schema.default;
					delete param.schema.default;
				}
				if (param.schema.pattern) {
					param.schema.items.pattern = param.schema.pattern;
					delete param.schema.pattern;
				}
				if (param.schema.minLength) {
					param.schema.items.minLength = param.schema.minLength;
					delete param.schema.minLength;
				}
				if (param.schema.maxLength) {
					param.schema.items.maxLength = param.schema.maxLength;
					delete param.schema.maxLength;
				}
			}
			param.required = false;
			if (filter.release_status == 'deprecated') {
				param.deprecated = true;
			}
			params.push(param);
		}
	}

	return optionCount;
}