<commit_before>import {
  graphql,
  GraphQLSchema,
  GraphQLNonNull,
  GraphQLObjectType,
  GraphQLScalarType,
  GraphQLBoolean,
  GraphQLString,
  GraphQLFloat,
  GraphQLID,
  GraphQLInt,
  GraphQLList,
} from 'graphql'

module.exports = (key, value) => {
  if (Array.isArray(value)) {
    const headType = getGraphQLType(``, value[0])
    return new GraphQLList(headType)
  }

  if (value === null) {
    return null
  }

  // Check if date object.
  if (typeof value.getMonth === `function`) {
    return `DATE`
  }

  switch (typeof value) {
    case `boolean`:
      return GraphQLBoolean
    case `string`:
      return GraphQLString
    case `object`:
      return GraphQLObjectType
    case `number`:
      return value % 1 == 0
        ? GraphQLInt
        : GraphQLFloat
  }
  return null
}
<commit_msg>Pull this change from PR #520<commit_after>import {
  graphql,
  GraphQLSchema,
  GraphQLNonNull,
  GraphQLObjectType,
  GraphQLScalarType,
  GraphQLBoolean,
  GraphQLString,
  GraphQLFloat,
  GraphQLID,
  GraphQLInt,
  GraphQLList,
} from 'graphql'

const getGraphQLType = (key, value) => {
  if (Array.isArray(value)) {
    const headType = getGraphQLType(``, value[0])
    return new GraphQLList(headType)
  }

  if (value === null) {
    return null
  }

  // Check if date object.
  if (typeof value.getMonth === `function`) {
    return `DATE`
  }

  switch (typeof value) {
    case `boolean`:
      return GraphQLBoolean
    case `string`:
      return GraphQLString
    case `object`:
      return GraphQLObjectType
    case `number`:
      return value % 1 == 0
        ? GraphQLInt
        : GraphQLFloat
  }
  return null
}

module.exports = getGraphQLType

{'fraction_non_alphanumeric': 0.10457516339869281, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 2.871264367816092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '950148', 'n_tokens_mistral': 572, 'n_tokens_neox': 560, 'n_words': 140}