I\'ve seen public exports of ES6 modules done in both of the following ways:
// method 1
export var getAnswer = function () { return \'forty two\'; };
// me
- Are both of these valid?
No, export function () { return answer; };
is invalid, either you use default, or you add a name to that function declaration.
- If so, why do they both exist?
They don't :)
- Are there other valid options for module exports using ES6 syntax?
You can see a lot of valid options here: https://github.com/eslint/espree/pull/43