# graphql-converter

> This package help you to create your graphql query out of array of properties name

Latest version **1.1.12** (published 2020-01-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install graphql-converter
pnpm add graphql-converter
yarn add graphql-converter
bun add graphql-converter
```

## 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.1.12 |
| Published | 2020-01-24 |
| First published | 2020-01-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Behnam Ghafary |
| Maintainers | behnamgh |
| Keywords | graphql, converter |

## Links

- npm: https://www.npmjs.com/package/graphql-converter
- Repository: https://github.com/Behnamgh/graphql-converter
- Homepage: https://github.com/Behnamgh/graphql-converter#readme
- Issues: https://github.com/Behnamgh/graphql-converter/issues
- npm.io page: https://npm.io/package/graphql-converter

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.1.12 (latest) — 2020-01-24
- 1.1.11 — 2020-01-24
- 1.1.51 — 2020-01-24
- 1.1.5 — 2020-01-24
- 1.1.3 — 2020-01-23
- 1.1.2 — 2020-01-23
- 1.1.1 — 2020-01-23
- 1.1.0 — 2020-01-23
- 1.0.3 — 2020-01-23
- 1.0.2 — 2020-01-23
- 1.0.1 — 2020-01-23
- 1.0.0 — 2020-01-23

## README

This is a package to help you in creating your graphql query out of array of string
# Instruction

## Installation
```
npm i graphql-converter
```
## Simple use
```javascript
import { gqlBuilder } from "graphql-converter";
// or
const gqlBuilder = require("graphql-converter").gqlBuilder;

// then you can convert your query
gqlBuilder(["test"]) // output is: { test }


gqlBuilder(["user.firstname","user.family","user.role", "user.email","user.address.street","user.address.postalCode"]) 
/* output is:
{
    user{
        firstname
        family
        role
        email
        address {
            street
            postalCode
        }
    }
}
/*
```
## Use with qgl with variable
```javascript
import gql from 'graphql-tag';
import { gqlBuilder } from "graphql-converter";


export const LOAD_LANG = gql`
query languages($token: String!){
languages(input:{perPage:100,page:1,q:"*",token:$token})
${gqlBuilder([
  "count",
  "result.key",
  "result.title",
  "result.id"
])}
}`
/* 
equal with:
export const LOAD_LANG = gql`
query languages($token: String!){
languages(input:{perPage:100,page:1,q:"*",token:$token}){
    count
    result{
        key
        title
        id
        }
    }
}`
*/
```

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