Return an object literal
Sometimes you need a function that just returns a simple object literal. However, something like
var foo = ()=>{
bar: 123
};
is a parsing compiler error. You can fix it by surrounding the object literal with ()
:
var foo = ()=>({
bar: 123
});