# @alkindix/graphql-utils

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

Latest version **1.5.1** (published 2022-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alkindix/graphql-utils
pnpm add @alkindix/graphql-utils
yarn add @alkindix/graphql-utils
bun add @alkindix/graphql-utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2022-08-17 |
| First published | 2022-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 726.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | alkindix |
| Keywords | typescript, graphql, graphql-utils, ast |

## Links

- npm: https://www.npmjs.com/package/@alkindix/graphql-utils
- Repository: https://github.com/AlkindiX/graphql-utils
- Homepage: https://jenyus-org.github.io/graphql-utils/
- Issues: https://github.com/AlkindiX/graphql-utils/issues
- npm.io page: https://npm.io/package/@alkindix/graphql-utils

## Dependencies (1)

- [graphql](https://npm.io/package/graphql.md) ^16.6.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2022-08-17

## README

# graphql-utils
![License: MIT](https://img.shields.io/github/license/Jenyus-Org/graphql-utils)
[![NPM Release](https://img.shields.io/npm/v/@jenyus-org/graphql-utils)](https://www.npmjs.com/package/@jenyus-org/graphql-utils)
[![NPM Downloads](https://img.shields.io/npm/dw/@jenyus-org/graphql-utils)](https://www.npmjs.com/package/@jenyus-org/graphql-utils)
[![NPM Type Definitions](https://img.shields.io/npm/types/@jenyus-org/graphql-utils)](https://www.npmjs.com/package/@jenyus-org/graphql-utils)

`@jenyus-org/graphql-utils` is a collection of utilities to aid in working with GraphQL projects that have the [`graphql`](https://github.com/graphql/graphql-js) library as a base.

- [graphql-utils](#graphql-utils)
  - [Documentation](#documentation)
  - [Installation](#installation)
  - [Getting Started](#getting-started)

## Documentation

The full documentation with live code sandboxes can be found [here](https://jenyus-org.github.io/graphql-utils/).

## Installation

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

NPM:

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

Yarn:

```bash
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:

```ts
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:

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

---
_Source: https://npm.io/package/@alkindix/graphql-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
