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

babel-plugin-graphql-js-client-transform

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-graphql-js-client-transform - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

lib/index.js

@@ -24,3 +24,3 @@ /**

*
* Version: 1.0.1 Commit: d00fbde
* Version: 1.0.3 Commit: 08b7df7
**/'use strict';

@@ -27,0 +27,0 @@

@@ -17,15 +17,16 @@ 'use strict';

if (argValue.kind === 'StringValue') {
return t.stringLiteral(argValue.value);
} else if (argValue.kind === 'EnumValue') {
return t.callExpression(t.memberExpression(clientId, t.identifier('enum')), [t.stringLiteral(argValue.value)]);
} else if (argValue.kind === 'IntValue') {
return t.numericLiteral(parseInt(argValue.value, 10));
} else if (argValue.kind === 'FloatValue') {
return t.numericLiteral(parseFloat(argValue.value));
} else if (argValue.kind === 'BooleanValue') {
return t.booleanLiteral(argValue.value);
} else {
throw Error('Unrecognized type "' + argValue.kind + '"');
switch (argValue.kind) {
case 'StringValue':
return t.stringLiteral(argValue.value);
case 'EnumValue':
return t.callExpression(t.memberExpression(clientId, t.identifier('enum')), [t.stringLiteral(argValue.value)]);
case 'IntValue':
return t.numericLiteral(parseInt(argValue.value, 10));
case 'FloatValue':
return t.numericLiteral(parseFloat(argValue.value));
case 'BooleanValue':
return t.booleanLiteral(argValue.value);
default:
throw Error('Unrecognized type "' + argValue.kind + '"');
}
}

@@ -21,3 +21,11 @@ 'use strict';

function extractVariableType(variable) {
return variable.type.kind === 'NonNullType' ? variable.type.type.name.value + '!' : variable.type.name.value;
switch (variable.kind) {
case 'NonNullType':
return extractVariableType(variable.type) + '!';
case 'ListType':
return '[' + extractVariableType(variable.type) + ']';
default:
// NamedType
return variable.name.value;
}
}

@@ -30,3 +38,3 @@

var args = [t.stringLiteral(variable.variable.name.value), t.stringLiteral(extractVariableType(variable))];
var args = [t.stringLiteral(variable.variable.name.value), t.stringLiteral(extractVariableType(variable.type))];

@@ -33,0 +41,0 @@ if (variable.defaultValue) {

{
"name": "babel-plugin-graphql-js-client-transform",
"version": "1.0.2",
"version": "1.0.3",
"description": "Babel plugin for transforming raw GraphQL queries into graphql-js-client query builder syntax",

@@ -5,0 +5,0 @@ "main": "lib/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