This...
.then(x => new Whatever(x));
...does the same thing as this:
.then(x => { return new Whatever(x); });
Addendum 4/6/2018: Remember if you do this simplification trick when newing up an object with curly braces that you need to wrap the curly braces in parenthesis. So this...
.then(x => { return {'foo':'bar','baz':'qux'} });
...becomes...
.then(x => ({'foo':'bar','baz':'qux'}) );
No comments:
Post a Comment