Created
May 6, 2020 13:23
-
-
Save sibelius/3432bd291fc8b6060e59488eecad3dc8 to your computer and use it in GitHub Desktop.
using JSON.stringify to strip some relay metadata from console.log
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
const excludeKeys = ['__fragments', '__id', '__fragmentOwner']; | |
// strip __fragments, __id, __fragmentOwne | |
const relayTransform = (key: string, value: string) => { | |
if (excludeKeys.includes(key)) { | |
return undefined; | |
} | |
return value; | |
}; | |
export const debugRelay = (value: any) => { | |
// eslint-disable-next-line | |
console.log(JSON.parse(JSON.stringify(value, relayTransform))); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment