mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 23:20: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 setOptions from './shared/options'
|
||||||
import { isUndefined } from './shared/is-type'
|
import { isUndefined } from './shared/is-type'
|
||||||
import $meta from './client/$meta'
|
import $meta from './client/$meta'
|
||||||
import hasMetaInfo from './shared/hasMetaInfo'
|
import { hasMetaInfo } from './shared/meta-helpers'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin install function.
|
* Plugin install function.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { version } from '../package.json'
|
|||||||
import createMixin from './shared/mixin'
|
import createMixin from './shared/mixin'
|
||||||
import setOptions from './shared/options'
|
import setOptions from './shared/options'
|
||||||
import $meta from './server/$meta'
|
import $meta from './server/$meta'
|
||||||
import hasMetaInfo from './shared/hasMetaInfo'
|
import { hasMetaInfo } from './shared/meta-helpers'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin install function.
|
* Plugin install function.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { merge } from './merge'
|
import { merge } from './merge'
|
||||||
import applyTemplate from './applyTemplate'
|
import { applyTemplate } from './template'
|
||||||
import inMetaInfoBranch from './inMetaInfoBranch'
|
import { inMetaInfoBranch } from './meta-helpers'
|
||||||
import { isFunction, isObject } from './is-type'
|
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 getComponentOption from '../../src/shared/getComponentOption'
|
||||||
import inMetaInfoBranch from '../../src/shared/inMetaInfoBranch'
|
import { inMetaInfoBranch } from '../../src/shared/meta-helpers'
|
||||||
import { mount, getVue, loadVueMetaPlugin } from '../utils'
|
import { mount, getVue, loadVueMetaPlugin } from '../utils'
|
||||||
|
|
||||||
describe('getComponentOption', () => {
|
describe('getComponentOption', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user