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:
committed by
Alexander Lichter
parent
f92fb67619
commit
419951c59f
+1
-1
@@ -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
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
|
||||
/**
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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,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', () => {
|
||||
|
||||
Reference in New Issue
Block a user