Socket
Book a DemoInstallSign in
Socket

gra

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gra

a wrapper around GraphQL's type module. It makes the syntax slightly less repetitive.

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Description

gra is a wrapper around GraphQL's type module. It makes the syntax slightly less repetitive.

Usage

Install

npm install --save graphql
npm install --save gra

Use it

var g = require('gra');

// Micro syntax
g.id // ==> GraphQLID,
g.i // ==> GraphQLInt,
g.f // ==> GraphQLFloat,
g.s // ==> GraphQLString,
g.b // ==> GraphQLBoolean,
g.o // ==> GraphQLObjectType,
g.l // ==> GraphQLList,
g.u // ==> GraphQLUnionType,
g.e // ==> GraphQLEnumType,
g.in // ==> GraphQLInputObjectType,
g.sc // ==> GraphQLScalarType,
g.if // ==> GraphQLInterfaceType,
g.nn // ==> GraphQLNonNull,
g.schema // ==> GraphQLSchema,

// Short syntax
g.ident // ==> GraphQLID,
g.int // ==> GraphQLInt,
g.float // ==> GraphQLFloat,
g.str // ==> GraphQLString,
g.bool // ==> GraphQLBoolean,
g.obj // ==> GraphQLObjectType,
g.list // ==> GraphQLList,
g.union // ==> GraphQLUnionType,
g.enum // ==> GraphQLEnumType,
g.input // ==> GraphQLInputObjectType,
g.scal // ==> GraphQLScalarType,
g.inter // ==> GraphQLInterfaceType,
g.non // ==> GraphQLNonNull,
g.schema // ==> GraphQLSchema,

// Medium syntax
g.identifier // ==> GraphQLID,
g.integer // ==> GraphQLInt,
g.float // ==> GraphQLFloat,
g.string // ==> GraphQLString,
g.boolean // ==> GraphQLBoolean,
g.object // ==> GraphQLObjectType,
g.list // ==> GraphQLList,
g.union // ==> GraphQLUnionType,
g.enum // ==> GraphQLEnumType,
g.inputObject // ==> GraphQLInputObjectType,
g.scalar // ==> GraphQLScalarType,
g.interface // ==> GraphQLInterfaceType,
g.nonNull // ==> GraphQLNonNull,
g.schema // ==> GraphQLSchema,

So, using g.i or g.int or g.integer is the same as using GraphQLInt.

You can mix and match micro, short, and medium syntax. They are all provided in various forms for convenience.

Each of the above can be used in place of its more verbose cousin.

GraphQL is a peerDependency of this project so you should not be hard coded to a specific GraphQL version.

Inspiration

https://twitter.com/samerbuna/status/771719039441702912

FAQs

Package last updated on 06 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts