Created
January 7, 2020 14:35
-
-
Save timsuchanek/11491f7da6d88e44229072b2ac1fa2d4 to your computer and use it in GitHub Desktop.
Are we called within a graphql-js resolver?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import callsite from 'callsite' | |
export function isGraphQLStack() { | |
const stack = callsite() | |
const functions = stack.map(s => s.getFunctionName()) | |
return ( | |
functions.includes('resolveFieldsValueOrError') && | |
functions.includes('resolveField') && | |
functions.includes('executeFields') | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment