MCPcopy Create free account
hub / github.com/Effect-TS/effect / findList

Function findList

packages/effect/src/graphql/GraphQLResolver.ts:773–783  ·  view source on GitHub ↗
(
  data: unknown,
  path: ReadonlyArray<string>
)

Source from the content-addressed store, hash-verified

771}
772
773const findList = (
774 data: unknown,
775 path: ReadonlyArray<string>
776): { readonly items: ReadonlyArray<unknown>; readonly truncated: boolean } | undefined => {
777 // Path guarantees object fields leading to a list.
778 let parent = data as Record<string, any> | null | undefined
779 for (let i = 0; i < path.length - 1; i++) parent = parent?.[path[i]]
780 const items = parent?.[path[path.length - 1]] as ReadonlyArray<unknown> | null | undefined
781 if (items === null || items === undefined) return undefined
782 return { items, truncated: parent!.pageInfo?.hasNextPage === true }
783}
784
785const matchesTypename = (item: unknown, typename: string | undefined): boolean =>
786 item !== null && item !== undefined &&

Callers 2

orderedFunction · 0.85
findByIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected