I am trying to export the result of a function in ES6. The function is unimportant - the following examples work for: const func = input => input
This works:
const a = 'foo'
const b = 'bar'
export default {
a: func(a),
b: func(b)
}
whereas these hit the error: SyntaxError: Unexpected token, expected ,
:
export {
a: func(a),
b: func(b)
}
also:
export {
func(a) as a,
func(b) as b
}
Could you explain why? This does not seem to cover the above cases.