In a javascript ES-2015 modules, can a module member be aware of what other module members there are?
For example, in a CommonJS module, this is possible:
function square(x) {
return x * x;
}
function whoAmI() {
return Object.keys(module.exports); // ['square','whoAmI']
}
module.exports = {
square: square,
whoAmI: whoAmI
};
In the equivalent ES-2015 module, how do we write the whoAmI()
function?
export function square(x) {
return x * x;
}
export function whoAmI() {
// ?????
}