index.js
function analyzeField (field) {
  var obj = {}
  var namedType = field.type
  obj.name = field.name
  obj.isDeprecated = field.isDeprecated
  obj.deprecationReason = field.deprecationReason
  obj.defaultValue = field.defaultValue
  if (namedType.kind === 'NON_NULL') {
    obj.isRequired = true
    namedType = namedType.ofType
  } else {
    obj.isRequired = false
  }
  if (namedType.kind === 'LIST') {
    obj.isList = true
    namedType = namedType.ofType
  } else {
    obj.isList = field.type.kind === 'LIST'
  }
  if (namedType.kind === 'NON_NULL') {
    obj.isNestedRequired = true
    namedType = namedType.ofType
  } else {
    obj.isNestedRequired = false
  }
  obj.type = namedType.name
  obj.isUnionType = namedType.kind === 'UNION'
  obj.isObjectType = namedType.kind === 'OBJECT'
  obj.isEnumType = namedType.kind === 'ENUM'
  obj.isInterfaceType = namedType.kind === 'INTERFACE'
  obj.isInputType = namedType.kind === 'INPUT_OBJECT'
  return obj
}
function analyzeField (field) {
  var obj = {}
  var namedType = field.type
  obj.name = field.name
  obj.isDeprecated = field.isDeprecated
  obj.deprecationReason = field.deprecationReason
  obj.defaultValue = field.defaultValue
  if (namedType.kind === 'NON_NULL') {
    obj.isRequired = true
    namedType = namedType.ofType
  } else {
    obj.isRequired = false
  }
  if (namedType.kind === 'LIST') {
    obj.isList = true
    namedType = namedType.ofType
  } else {
    obj.isList = field.type.kind === 'LIST'
  }
  if (namedType.kind === 'NON_NULL') {
    obj.isNestedRequired = true
    namedType = namedType.ofType
  } else {
    obj.isNestedRequired = false
  }
  obj.type = namedType.name
  obj.isUnionType = namedType.kind === 'UNION'
  obj.isObjectType = namedType.kind === 'OBJECT'
  obj.isEnumType = namedType.kind === 'ENUM'
  obj.isInterfaceType = namedType.kind === 'INTERFACE'
  obj.isInputType = namedType.kind === 'INPUT_OBJECT'
  return obj
}
function analyzeField ( field ) { var obj = { } var namedType = field . type obj . name = field . name obj . isDeprecated = field . isDeprecated obj . deprecationReason = field . deprecationReason obj . defaultValue = field . defaultValue if ( namedType . kind === 'NON_NULL' ) { obj . isRequired = true namedType = namedType . ofType } else { obj . isRequired = false } if ( namedType . kind === 'LIST' ) { obj . isList = true namedType = namedType . ofType } else { obj . isList = field . type . kind === 'LIST' } if ( namedType . kind === 'NON_NULL' ) { obj . isNestedRequired = true namedType = namedType . ofType } else { obj . isNestedRequired = false } obj . type = namedType . name obj . isUnionType = namedType . kind === 'UNION' obj . isObjectType = namedType . kind === 'OBJECT' obj . isEnumType = namedType . kind === 'ENUM' obj . isInterfaceType = namedType . kind === 'INTERFACE' obj . isInputType = namedType . kind === 'INPUT_OBJECT' return obj }
analyzes a field and returns a simplified object
analyzes a field and returns a simplified object