Socket
Book a DemoInstallSign in
Socket

@jenyus-org/graphql-utils

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jenyus-org/graphql-utils

GraphQL utilities to make working with GraphQL queries and APIs simpler.

1.5.0
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

graphql-utils

License: MIT NPM Release NPM Downloads NPM Type Definitions

@jenyus-org/graphql-utils is a collection of utilities to aid in working with GraphQL projects that have the graphql library as a base.

Documentation

The full documentation with live code sandboxes can be found here.

Installation

@jenyus-org/graphql-utils can be installed from NPM by running one of the following commands:

NPM:

npm i --save @jenyus-org/graphql-utils

Yarn:

yarn add @jenyus-org/graphql-utils

This will install @jenyus-org/graphql-utils and all its dependencies.

Getting Started

One of the most straightforward and common use-cases of GraphQL-Utils is checking if a query contains a certain path. We can do this using the hasFields() utility:

import { hasFields } from "@jenyus-org/graphql-utils";

const resolvers = {
  Query: {
    posts(_, __, ___, info) {
      const requestedAuthor = hasFields(info, "posts.author");
      console.log(requestedAuthor);
    },
  },
};

This will output true for the following query:

{
  posts {
    id
    title
    body
    author {
      id
      username
      firstName
      lastName
    }
  }
}

Keywords

typescript

FAQs

Package last updated on 24 Mar 2021

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.