Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-to-postman

Package Overview
Dependencies
Maintainers
5
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-to-postman - npm Package Compare versions

Comparing version 0.0.12-beta.1 to 0.0.12-beta.2

39

lib/assets/gql-generator.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc