What is the benefit of using arrow function while exporting?
sarbbottam opened this issue · comments
This issue is not related to the functionality of this module.
What is the benefit of arrow function
module.exports = x => {
...
return x;
};
over
module.exports = function (x) {
...
return x;
};
when exporting.
I had been using arrow functions every where possible, but did not find it useful, thus changed it.
Does it emphasize that when ever there is a anonymous function
or function expression
use arrow function
?
I think it's just a personal taste to be honest. But if you choose one over the other, be consistent. Personally I prefer the fat-arrow function.
Shorter and lexical scoping: http://bfy.tw/6cSm
Thanks!
Shorter and lexical scoping: http://bfy.tw/6cSm
Not sure, if I follow the benefit of lexical scoping
in module.exports
, I did google
but did not find any convincing answer, other than what @SamVerschueren stated
I think it's just a personal taste to be honest.
I thought it's better to get expert's suggestion.
I didn't expect http://bfy.tw/6cSm to be LMGTFY, closing the issue w/o any comment wound have been less insulting.
Wasn't meant to be insulting...
This choice is actually breaking my build, as sourcemaps is refusing to work in Windows native Bash, due to unexpected token.
Upgrade Node.js to 4+. Or what are you exactly trying to do here?
That's not really an option with the native Bash for Windows. It does work in Ming and git bash though.