{"size": 706, "ext": "js", "max_stars_repo_path": "src/server/generateServerInjector.js", "max_stars_repo_name": "maxchou415/vue-meta", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/server/generateServerInjector.js", "max_issues_repo_name": "maxchou415/vue-meta", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/server/generateServerInjector.js", "max_forks_repo_name": "maxchou415/vue-meta", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.6956521739, "max_line_length": 79, "alphanum_fraction": 0.7138810198}
import { metaInfoAttributeKeys } from '../shared/constants'
import { titleGenerator, attributeGenerator, tagGenerator } from './generators'

/**
 * Converts a meta info property to one that can be stringified on the server
 *
 * @param  {String} type - the type of data to convert
 * @param  {(String|Object|Array<Object>)} data - the data value
 * @return {Object} - the new injector
 */

export default function generateServerInjector(appId, options, type, data) {
  if (type === 'title') {
    return titleGenerator(appId, options, type, data)
  }

  if (metaInfoAttributeKeys.includes(type)) {
    return attributeGenerator(options, type, data)
  }

  return tagGenerator(appId, options, type, data)
}
