graphql-to-postman
Advanced tools
Comparing version 0.0.12-beta.1 to 0.0.12-beta.2
@@ -7,2 +7,11 @@ // Forked from https://github.com/timqian/gql-generator. | ||
/** | ||
* Gets depth of stringified array | ||
* | ||
* @param {String} value Stringified array | ||
*/ | ||
getDepthOfArray = (value) => { | ||
return (value.match(/\[/g)).length; | ||
}, | ||
/** | ||
* Generate variables string | ||
@@ -39,7 +48,24 @@ * | ||
if (!matchedType) { | ||
return type.split('!')[0]; | ||
if (matchedType) { | ||
return matchedType; | ||
} | ||
// If type is not from the sclar types but is a user defined type | ||
else if (type.includes('[')) { | ||
const getSplitString = (ArrayDepth, identifier) => { | ||
let splitString = identifier; | ||
return matchedType; | ||
while (ArrayDepth > 1) { | ||
splitString += identifier; | ||
ArrayDepth--; | ||
} | ||
return splitString; | ||
}, | ||
depth = getDepthOfArray(type); | ||
type = type.split(getSplitString(depth, '['))[1].split(getSplitString(depth, ']'))[0]; | ||
} | ||
return type.split('!')[0]; | ||
}, | ||
@@ -142,8 +168,5 @@ | ||
if (type.toString().includes('[')) { | ||
const getArrayDepth = (value) => { | ||
return (value.match(/\[/g)).length; | ||
}, | ||
defaultForType = getDefaultForType(argType.toString()); | ||
const defaultForType = getDefaultForType(argType.toString()); | ||
let depth = getArrayDepth(type.toString()), | ||
let depth = getDepthOfArray(type.toString()), | ||
result = defaultForType; | ||
@@ -150,0 +173,0 @@ |
{ | ||
"name": "graphql-to-postman", | ||
"version": "0.0.12-beta.1", | ||
"version": "0.0.12-beta.2", | ||
"description": "Generates a Postman Collection from a GraphQL schema.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
52493
748
0