Nuxt/packages/utils/src/context.js

17 lines
409 B
JavaScript
Raw Normal View History

2018-12-22 21:05:13 +00:00
export const getContext = function getContext (req, res) {
2018-12-22 21:05:13 +00:00
return { req, res }
}
export const determineGlobals = function determineGlobals (globalName, globals) {
2018-12-22 21:05:13 +00:00
const _globals = {}
for (const global in globals) {
if (typeof globals[global] === 'function') {
_globals[global] = globals[global](globalName)
} else {
_globals[global] = globals[global]
}
}
return _globals
}