All files / src/definitions structures.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  8x 8x 8x 8x 1x   8x 2x                                  
/**
 * Copyright (c) 2017-present, Graphene.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */
import { getGraphQLType } from "./../reflection";
import { GraphQLList, GraphQLType, GraphQLNonNull } from "graphql";
 
// Helper funciton that will convert something like:
// List(String)
// To:
// GraphQLList(GraphQLString)
export const List = (ofType: any): GraphQLList<GraphQLType> => {
  return new GraphQLList(getGraphQLType(ofType));
};
 
// Helper funciton that will convert something like:
// NonNull(String)
// To:
// GraphQLNonNull(GraphQLString)
export const NonNull = (ofType: any): GraphQLNonNull<GraphQLType> => {
  return new GraphQLNonNull(getGraphQLType(ofType));
};