Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // those 2 abstract of the same library are supposed to do the exact same thing, but are written totally differently
- // because no one cared about restricting the way you should use their public API.
- // because there's no real public API, because JS.
- const hasSubscriptionOperation = ({ query: { definitions } }) => {
- return definitions.some(
- ({ kind, operation }) =>
- kind === 'OperationDefinition' && operation === 'subscription'
- )
- }
- // VS
- import { getMainDefinition } from 'apollo-utilities';
- const subscription = ({ query }) => {
- const { kind, operation } = getMainDefinition(query);
- return kind === 'OperationDefinition' && operation === 'subscription';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement