2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-16 17:10:34 +03:00

refactor: combine meta helpers

This commit is contained in:
pimlie
2019-03-10 11:56:19 +01:00
committed by Alexander Lichter
parent f92fb67619
commit 419951c59f
7 changed files with 16 additions and 17 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import createMixin from './shared/mixin'
import setOptions from './shared/options'
import { isUndefined } from './shared/is-type'
import $meta from './client/$meta'
import hasMetaInfo from './shared/hasMetaInfo'
import { hasMetaInfo } from './shared/meta-helpers'
/**
* Plugin install function.
+1 -1
View File
@@ -2,7 +2,7 @@ import { version } from '../package.json'
import createMixin from './shared/mixin'
import setOptions from './shared/options'
import $meta from './server/$meta'
import hasMetaInfo from './shared/hasMetaInfo'
import { hasMetaInfo } from './shared/meta-helpers'
/**
* Plugin install function.
+2 -2
View File
@@ -1,6 +1,6 @@
import { merge } from './merge'
import applyTemplate from './applyTemplate'
import inMetaInfoBranch from './inMetaInfoBranch'
import { applyTemplate } from './template'
import { inMetaInfoBranch } from './meta-helpers'
import { isFunction, isObject } from './is-type'
/**
-6
View File
@@ -1,6 +0,0 @@
import { isObject } from './is-type'
// Vue $root instance has a _vueMeta object property, otherwise its a boolean true
export default function hasMetaInfo(vm = this) {
return vm && (vm._vueMeta === true || isObject(vm._vueMeta))
}
-6
View File
@@ -1,6 +0,0 @@
import { isUndefined } from './is-type'
// a component is in a metaInfo branch when itself has meta info or one of its (grand-)children has
export default function inMetaInfoBranch(vm = this) {
return vm && !isUndefined(vm._vueMeta)
}
+11
View File
@@ -0,0 +1,11 @@
import { isUndefined, isObject } from './is-type'
// Vue $root instance has a _vueMeta object property, otherwise its a boolean true
export function hasMetaInfo(vm = this) {
return vm && (vm._vueMeta === true || isObject(vm._vueMeta))
}
// a component is in a metaInfo branch when itself has meta info or one of its (grand-)children has
export function inMetaInfoBranch(vm = this) {
return vm && !isUndefined(vm._vueMeta)
}
+1 -1
View File
@@ -1,5 +1,5 @@
import getComponentOption from '../../src/shared/getComponentOption'
import inMetaInfoBranch from '../../src/shared/inMetaInfoBranch'
import { inMetaInfoBranch } from '../../src/shared/meta-helpers'
import { mount, getVue, loadVueMetaPlugin } from '../utils'
describe('getComponentOption', () => {