Skip to content

Commit

Permalink
feat: use named exports to export helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Mar 5, 2019
1 parent 9c80dab commit 95c3b7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
* Plugin install function.
* @param {Function} Vue - the Vue constructor.
*/
function VueMeta(Vue, options = {}) {
function install(Vue, options = {}) {
options = setOptions(options)

Vue.prototype.$meta = $meta(options)

Vue.mixin(createMixin(Vue, options))
}

VueMeta.version = version

// automatic install
if (!isUndefined(window) && !isUndefined(window.Vue)) {
/* istanbul ignore next */
Vue.use(VueMeta)
install(window.Vue)
}

export default VueMeta
export {
version,
install
}
9 changes: 5 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ export { hasMetaInfo } from './shared/hasMetaInfo'
* Plugin install function.
* @param {Function} Vue - the Vue constructor.
*/
function VueMeta(Vue, options = {}) {
function install(Vue, options = {}) {
options = setOptions(options)

Vue.prototype.$meta = $meta(options)

Vue.mixin(createMixin(Vue, options))
}

VueMeta.version = version

export default VueMeta
export {
version,
install
}
4 changes: 3 additions & 1 deletion test/plugin-server.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { mount, defaultOptions, hasMetaInfo, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
import { mount, defaultOptions, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'

const { hasMetaInfo } = VueMetaServerPlugin

jest.mock('../package.json', () => ({
version: 'test-version'
Expand Down
5 changes: 2 additions & 3 deletions test/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount, createLocalVue } from '@vue/test-utils'
import { renderToString } from '@vue/server-test-utils'
import VueMetaBrowserPlugin from '../../src/browser'
import VueMetaServerPlugin, { hasMetaInfo } from '../../src'
import * as VueMetaBrowserPlugin from '../../src/browser'
import * as VueMetaServerPlugin from '../../src'

import {
keyName,
Expand All @@ -15,7 +15,6 @@ import {
export {
mount,
renderToString,
hasMetaInfo,
VueMetaBrowserPlugin,
VueMetaServerPlugin
}
Expand Down

0 comments on commit 95c3b7d

Please sign in to comment.