Created
April 14, 2017 04:06
-
-
Save SachaG/e9cf798ae62d809cffb288846b5150f4 to your computer and use it in GitHub Desktop.
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
let mutation; | |
if (args) { | |
const args1 = _.map(args, (type, name) => `$${name}: ${type}`); // e.g. $url: String | |
const args2 = _.map(args, (type, name) => `${name}: $${name}`); // e.g. $url: url | |
mutation = ` | |
mutation ${name}(${args1}) { | |
${name}(${args2}) | |
} | |
` | |
} else { | |
mutation = ` | |
mutation ${name} { | |
${name} | |
} | |
` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment