2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-02 08:14:04 +03:00
Files
vue-meta/src/server/generateServerInjector.js
T
Declan de Wet 814a0dd2c3 fix tests
2016-11-10 17:47:54 +02:00

25 lines
817 B
JavaScript

import titleGenerator from './generators/titleGenerator'
import attrsGenerator from './generators/attrsGenerator'
import tagGenerator from './generators/tagGenerator'
export default function _generateServerInjector (options = {}) {
/**
* 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
*/
return function generateServerInjector (type, data) {
switch (type) {
case 'title':
return titleGenerator(options)(type, data)
case 'htmlAttrs':
case 'bodyAttrs':
return attrsGenerator(options)(type, data)
default:
return tagGenerator(options)(type, data)
}
}
}