Skip to content

Instantly share code, notes, and snippets.

View Groxot's full-sized avatar
I may be slow to respond.

Gopard Groxot

I may be slow to respond.
View GitHub Profile
@Groxot
Groxot / graphQLUtils.ts
Last active February 8, 2018 21:37 — forked from matthewdenobrega/graphQLUtils.ts
GraphQL query generator
// Angular imports
import { isArray, isBlank, isDate, isNumber, isStringMap, isPresent, isString } from 'angular2/src/facade/lang'
export class GraphQLUtils {
static createMutation(data: Object, dataDefinition: Object, method: string, mutationName?: string): string {
if (!method || !data) { return null }
let mutation: string = (mutationName || method) + '{' + method
mutation += '(' + GraphQLUtils.flattenObject(data) + ')'