Nuxt/test/fixtures/basic/plugins/inject.js
pooya parsa e7cc2757c3 refactor: update eslint-config to 1.x
Co-authored-by: Alexander Lichter <manniL@gmx.net>
2019-07-10 15:15:49 +04:30

17 lines
335 B
JavaScript

export default ({ route, params }, inject) => {
const { injectValue } = route.query
if (typeof injectValue === 'undefined') {
return
}
const key = 'injectedProperty'
const map = {
undefined,
'null': null,
'false': false,
'0': 0,
'empty': ''
}
const value = map[injectValue]
inject(key, value)
}