5 lines
247 B
TypeScript
5 lines
247 B
TypeScript
// Helper: Extracts nodes from a GraphQL connection object, returning an empty array if nodes are absent.
|
|
export function extractNodes<T>(connection: { nodes?: readonly T[] } | null | undefined): readonly T[] {
|
|
return connection?.nodes ?? [];
|
|
}
|