matchesScheduledTaskQuery (scheduled-tasks/search.ts)

gitingest_bytedance_deer-flow · frontend/src/core/scheduled-tasks/search.ts · typescript · MIT
automation, tag:knn-classified

Utility to check if a scheduled task matches a search query by title or prompt.

// Source: https://github.com/bytedance/deer-flow | License: MIT | Copyright 2025 Bytedance Ltd. and/or its affiliates
// Provided via justclaw.it.com; keep this notice with the code.
import type { ScheduledTask } from "./types";

/** Literal, case-insensitive title/prompt matching; blank queries match all tasks. */
export function matchesScheduledTaskQuery(
  task: Pick<ScheduledTask, "title" | "prompt">,
  query: string,
): boolean {
  const needle = query.trim().toLowerCase();
  return (
    !needle ||
    task.title.toLowerCase().includes(needle) ||
    task.prompt.toLowerCase().includes(needle)
  );
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key