MCPcopy
hub / github.com/triggerdotdev/trigger.dev / useMatchesData

Function useMatchesData

apps/webapp/app/utils.ts:34–50  ·  view source on GitHub ↗
(id: string | string[], debug: boolean = false)

Source from the content-addressed store, hash-verified

32 * @returns {JSON|undefined} The router data or undefined if not found
33 */
34export function useMatchesData(id: string | string[], debug: boolean = false): UIMatch | undefined {
35 const matchingRoutes = useMatches();
36
37 if (debug) {
38 console.log("matchingRoutes", matchingRoutes);
39 }
40
41 const paths = Array.isArray(id) ? id : [id];
42
43 // Get the first matching route
44 const route = paths.reduce((acc, path) => {
45 if (acc) return acc;
46 return matchingRoutes.find((route) => route.id === path);
47 }, undefined as UIMatch | undefined);
48
49 return route;
50}
51
52export function validateEmail(email: unknown): email is string {
53 return typeof email === "string" && email.length > 3 && email.includes("@");

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…