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

graphql-tag

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-tag - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

.editorconfig

50

index.js

@@ -5,34 +5,34 @@ var parse = require('./parser').parse;

function stripLoc(doc) {
var docType = Object.prototype.toString.call(doc);
function stripLoc (doc) {
var docType = Object.prototype.toString.call(doc);
if (docType === '[object Array]') {
return doc.map(stripLoc);
}
if (docType === '[object Array]') {
return doc.map(stripLoc);
}
if (docType !== '[object Object]') {
throw new Error('Unexpected input.');
}
if (docType !== '[object Object]') {
throw new Error('Unexpected input.');
}
if (doc.loc) {
delete doc.loc;
}
if (doc.loc) {
delete doc.loc;
}
var keys = Object.keys(doc);
var key;
var value;
var valueType;
var keys = Object.keys(doc);
var key;
var value;
var valueType;
for (key in keys) {
if (keys.hasOwnProperty(key)) {
value = doc[keys[key]];
valueType = Object.prototype.toString.call(value);
for (key in keys) {
if (keys.hasOwnProperty(key)) {
value = doc[keys[key]];
valueType = Object.prototype.toString.call(value);
if (valueType === '[object Object]' || valueType === '[object Array]') {
doc[keys[key]] = stripLoc(value);
}
}
}
if (valueType === '[object Object]' || valueType === '[object Array]') {
doc[keys[key]] = stripLoc(value);
}
}
}
return doc;
return doc;
}

@@ -39,0 +39,0 @@

{
"name": "graphql-tag",
"version": "0.1.14",
"version": "0.1.15",
"description": "A JavaScript template literal tag that parses GraphQL queries",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -67,2 +67,27 @@ # graphql-tag

### Webpack preprocessing
This package also includes a [webpack loader](https://webpack.github.io/docs/loaders.html). There are many benefits over this approach, which saves GraphQL ASTs processing time on client-side, optimizes bundle size and enable queries to be separated from script over `.graphql` files.
```js
loaders: [
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
}
]
```
then:
```js
import query from './query.graphql';
console.log(query);
// {
// "kind": "Document",
// ...
```
### Parser and printer

@@ -69,0 +94,0 @@

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