Skip to content

Commit 023dde9

Browse files
SinanMtlf
authored andcommitted
Bracket type parsing problem fixed (#52)
* Bracket type parsing problem fixed * Bracket variable test added
1 parent a38ad15 commit 023dde9

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

graphql.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@
252252
var types = []
253253
for (var key in variables) {
254254
var value = variables[key]
255-
var keyAndType = key.split("!")
255+
var keyAndType = key.split(/^(.*?)\!/)
256+
if (keyAndType.length > 1) {
257+
keyAndType = keyAndType.slice(1)
258+
keyAndType[1] = keyAndType[1].replace(/(.*?)\!$/, "$1")
259+
}
256260
var mapping = typeMap[typeof(value)]
257261
var mappedType = typeof(mapping) === "function" ? mapping(value) : mapping
258262
if (!key.match("!") && keyAndType[0].match(/_?id/i)) {

0 commit comments

Comments
 (0)