1
- import { ensureIsArray } from '../utils/ensure '
1
+ import { escapeMetaInfo } from '../shared/escaping '
2
2
import { applyTemplate } from './template'
3
- import { defaultInfo , disableOptionKeys } from './constants'
4
- import { escape } from './escaping'
5
- import getComponentOption from './getComponentOption'
6
3
7
4
/**
8
5
* Returns the correct meta info for the given component
@@ -11,10 +8,7 @@ import getComponentOption from './getComponentOption'
11
8
* @param {Object } component - the Vue instance to get meta info from
12
9
* @return {Object } - returned meta info
13
10
*/
14
- export default function getMetaInfo ( options = { } , component , escapeSequences = [ ] ) {
15
- // collect & aggregate all metaInfo $options
16
- let info = getComponentOption ( options , component , defaultInfo )
17
-
11
+ export default function getMetaInfo ( options = { } , info , escapeSequences = [ ] , component ) {
18
12
// Remove all "template" tags from meta
19
13
20
14
// backup the title chunk in case user wants access to it
@@ -33,24 +27,5 @@ export default function getMetaInfo (options = {}, component, escapeSequences =
33
27
info . base = Object . keys ( info . base ) . length ? [ info . base ] : [ ]
34
28
}
35
29
36
- const escapeOptions = {
37
- doEscape : value => escapeSequences . reduce ( ( val , [ v , r ] ) => val . replace ( v , r ) , value )
38
- }
39
-
40
- disableOptionKeys . forEach ( ( disableKey , index ) => {
41
- if ( index === 0 ) {
42
- ensureIsArray ( info , disableKey )
43
- } else if ( index === 1 ) {
44
- for ( const key in info [ disableKey ] ) {
45
- ensureIsArray ( info [ disableKey ] , key )
46
- }
47
- }
48
-
49
- escapeOptions [ disableKey ] = info [ disableKey ]
50
- } )
51
-
52
- // begin sanitization
53
- info = escape ( info , options , escapeOptions )
54
-
55
- return info
30
+ return escapeMetaInfo ( options , info , escapeSequences )
56
31
}
0 commit comments