Automatically naming anonymous functions
babel
automatically names anonymous functions by default which is useful in debugging:
$ cat a.js
var foo = function(x) {
return {
bar: function(y) {
return x * y;
}
}
}
$ babel a.js
"use strict";
var foo = function foo(x) {
return {
bar: function bar(y) {
return x * y;
}
};
};
Notice the new function names were added to the FunctionExpression on the right of the variable assignment and the object literal value.
buble
does not do this:
$ buble a.js
var foo = function(x) {
return {
bar: function(y) {
return x * y;
}
}
}
Do you think buble
should do the same?
The superfluous function name can stripped by Uglify, so output size shouldn't be a concern.