Filters top pages and queries using numeric boundaries and text inclusion/exclusion terms. Reuse in SEO or analytics dashboards for search data filtering.
// Source: https://github.com/every-app/open-seo | License: MIT | Copyright 2026 Ben Senescu
// Provided via justclaw.it.com; keep this notice with the code.
import { parseTerms } from "@/client/features/keywords/utils";
import type { BrandLookupResult } from "@/types/schemas/ai-search";
import type {
QueriesFilterValues,
TopPagesFilterValues,
} from "./brandLookupFilterTypes";
function passesNumericFilter(
value: number | null | undefined,
min: string,
max: string,
): boolean {
if (value == null) return true;
const minN = Number(min);
if (min && !Number.isNaN(minN) && value < minN) return false;
const maxN = Number(max);
if (max && !Number.isNaN(maxN) && value > maxN) return false;
return true;
}
function passesTextFilter(
haystack: string,
includeTerms: string
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key