index.js
function processType (item, entities, types) {
  var type = _.find(types, { name: item })

  var additionalTypes = []
  // get the type names of the union or interface's possible types, given its type name
  var addPossibleTypes = typeName => {
    var union = _.find(types, { name: typeName })
    var possibleTypes = _.map(union.possibleTypes, 'name')

    // we must also process the union/interface type, as well as its possible types
    additionalTypes = _.union(additionalTypes, possibleTypes, [typeName])
  }

  var fields = _.map(type.fields, field => {
    var obj = analyzeField.call(this, field)

    if (
      (obj.isUnionType && !this.theme.unions.hide) ||
      (obj.isInterfaceType && !this.theme.interfaces.hide)
    ) {
      addPossibleTypes(obj.type)
    }

    // process args
    if (!this.theme.field.noargs) {
      if (field.args && field.args.length) {
        obj.args = _.map(field.args, analyzeField.bind(this))
      }
    }

    return obj
  })

  entities[type.name] = {
    name: type.name,
    fields: fields,
    isObjectType: true,
    isInterfaceType: type.kind === 'INTERFACE',
    isUnionType: type.kind === 'UNION',
    possibleTypes: _.map(type.possibleTypes, 'name')
  }

  var linkeditems = _.chain(fields)
    .filter('isObjectType')
    .map('type')
    .union(additionalTypes)
    .uniq()
    .value()

  return linkeditems
}
function processType (item, entities, types) {
  var type = _.find(types, { name: item })

  var additionalTypes = []
  // get the type names of the union or interface's possible types, given its type name
  var addPossibleTypes = typeName => {
    var union = _.find(types, { name: typeName })
    var possibleTypes = _.map(union.possibleTypes, 'name')

    // we must also process the union/interface type, as well as its possible types
    additionalTypes = _.union(additionalTypes, possibleTypes, [typeName])
  }

  var fields = _.map(type.fields, field => {
    var obj = analyzeField.call(this, field)

    if (
      (obj.isUnionType && !this.theme.unions.hide) ||
      (obj.isInterfaceType && !this.theme.interfaces.hide)
    ) {
      addPossibleTypes(obj.type)
    }

    // process args
    if (!this.theme.field.noargs) {
      if (field.args && field.args.length) {
        obj.args = _.map(field.args, analyzeField.bind(this))
      }
    }

    return obj
  })

  entities[type.name] = {
    name: type.name,
    fields: fields,
    isObjectType: true,
    isInterfaceType: type.kind === 'INTERFACE',
    isUnionType: type.kind === 'UNION',
    possibleTypes: _.map(type.possibleTypes, 'name')
  }

  var linkeditems = _.chain(fields)
    .filter('isObjectType')
    .map('type')
    .union(additionalTypes)
    .uniq()
    .value()

  return linkeditems
}
function processType ( item , entities , types ) { var type = _ . find ( types , { name : item } ) var additionalTypes = [ ] // get the type names of the union or interface's possible types, given its type name var addPossibleTypes = typeName => { var union = _ . find ( types , { name : typeName } ) var possibleTypes = _ . map ( union . possibleTypes , 'name' ) // we must also process the union/interface type, as well as its possible types additionalTypes = _ . union ( additionalTypes , possibleTypes , [ typeName ] ) } var fields = _ . map ( type . fields , field => { var obj = analyzeField . call ( this , field ) if ( ( obj . isUnionType && ! this . theme . unions . hide ) || ( obj . isInterfaceType && ! this . theme . interfaces . hide ) ) { addPossibleTypes ( obj . type ) } // process args if ( ! this . theme . field . noargs ) { if ( field . args && field . args . length ) { obj . args = _ . map ( field . args , analyzeField . bind ( this ) ) } } return obj } ) entities [ type . name ] = { name : type . name , fields : fields , isObjectType : true , isInterfaceType : type . kind === 'INTERFACE' , isUnionType : type . kind === 'UNION' , possibleTypes : _ . map ( type . possibleTypes , 'name' ) } var linkeditems = _ . chain ( fields ) . filter ( 'isObjectType' ) . map ( 'type' ) . union ( additionalTypes ) . uniq ( ) . value ( ) return linkeditems }
process a graphql type object returns simplified version of the type
process a graphql type object returns simplified version of the type