UNPKG

relay-utils

Version:

Utilities for working with Relay (modern) in general, and the Relay store in particular.

23 lines (19 loc) 517 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.collectConnectionNodes = collectConnectionNodes; /** * Collects all nodes from a connection and filters out nulls. */ function collectConnectionNodes(connectionObj) { if (connectionObj && connectionObj.edges && connectionObj.edges.length > 0) { return connectionObj.edges.reduce(function (acc, curr) { if (curr && curr.node) { acc.push(curr.node); } return acc; }, []); } return []; }