Relay Connections Deconstructor
Description
Not all of us love the Relay spec but sometimes we need to wrestle with a third-party service that uses it. We find ourselves wrestling with edges and nodes and edges and nodes and edges and...
Welp, I wrote a quick little function to flatten out said edges and nodes and edges and nodes.
Installation
yarn add relay-connections-deconstructor
or
npm install relay-connections-deconstructor
Usage
; ; ;console.logdeconstructedObject;// 👇// {// friends: [// {// name: 'Han Solo',// cursor: 'Y3Vyc29yMg==',// },// {// name: 'Leia Organa',// cursor: 'Y3Vyc29yMw==',// },// ],// planets: [// { cursor: 'Y3Vyc29yMg==', name: 'Pluto' },// { cursor: 'Y3Vyc29yMw==', name: 'Mars' },// ],// }; ;console.logjustTheFriends;// 👇// [// {// name: 'Han Solo',// cursor: 'Y3Vyc29yMg==',// },// {// name: 'Leia Organa',// cursor: 'Y3Vyc29yMw==',// },// ]