Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

496 B
Raw Blame
const taskLinkPattern =
  /\/dashboard\/workspace\/[\w-]+\/project\/([\w-]+)\/task\/([\w-]+)(?![\w-])/g;

export function extractTaskLinks(...texts: (string | null | undefined)[]) {
  const links = new Map<string, { projectId: string; taskId: string }>();
  for (const text of texts) {
    for (const [, projectId, taskId] of (text ?? "").matchAll(
      taskLinkPattern,
    )) {
      if (projectId && taskId) links.set(taskId, { projectId, taskId });
    }
  }
  return [...links.values()];
}