searchHref

tcmts.registry.pages.searchHref · #g3ut2dow · term · runs anywhere

A search's address.

import type { SearchAsked } from "#codebase/tcmts/registry/pages";
import { at } from "#codebase/tcmts/share";

export function searchHref(q: string, o: SearchAsked): string {
  const p = new URLSearchParams({ q });
  if (o.by) p.set("by", o.by);
  for (const k of ["pure", "reviewed", "browser"] as const) if (o[k]) p.set(k, "1");
  return at(`/search?${p}`);
}

uses

used by