A pure library to convert json objects into graphql queries
It refers to a representation of the parameters that can be passed to an object.
It refers to a representation of the fields of an object, and can be presented in two ways:
- Object and can be represented by mapping each field to its arguments and fields
A simpler solution so each name mapped to its value. But, fields must be mapped to
something. (empty fields or arguments are ignored and fields starting with $
are formatted as is)
Example:
formatGraphqlQuery({
field0: true,
field1: {
subfield0: true,
subfield1: {
// Sub Subfields
},
subfield2: [{/* Arguments */}, {
// Sub Subfields
}]
},
field2: [{/* Arguments */}, {
subfield0: true,
subfield1: {
// Sub Subfields
},
subfield2: [{/* Arguments */}, {
// Sub Subfields
}]
}]
})
- The two styles are interchangeable, and one style can be nested in another
- Written in typescript
- Natively supports the browser
You can install this via NPM with:
npm install
You can install it in the browser by adding this tag (replace TAG
with the version):
<script src="https://cdn.jsdelivr.net/gh/cufyorg-archive/gql-query@TAG/build/index.js" type="module"></script>