Bug 149333 - Web Inspector: Simplify some functional callbacks
Summary: Web Inspector: Simplify some functional callbacks
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: DoNotImportToRadar
Depends on:
Blocks:
 
Reported: 2015-09-17 21:23 PDT by Joseph Pecoraro
Modified: 2015-09-18 00:36 PDT (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (7.26 KB, patch)
2015-09-17 21:50 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-09-17 21:23:10 PDT
* SUMMARY
Simplify some functional callbacks.

We have a few cases of:

  arr.map( (x) => { return foo(x) } )

Which can just be:

  arr.map(foo)
Comment 1 Joseph Pecoraro 2015-09-17 21:50:56 PDT
Created attachment 261487 [details]
[PATCH] Proposed Fix
Comment 2 BJ Burg 2015-09-17 22:18:02 PDT
Comment on attachment 261487 [details]
[PATCH] Proposed Fix

r=me

I did not know you could Array.map a constructor, but i guess it works!
Comment 3 WebKit Commit Bot 2015-09-17 23:04:56 PDT
Comment on attachment 261487 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 261487

Committed r189965: <http://trac.webkit.org/changeset/189965>
Comment 4 WebKit Commit Bot 2015-09-17 23:05:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Joseph Pecoraro 2015-09-18 00:36:02 PDT
> I did not know you could Array.map a constructor

To be clear, none of these were replacing calls to constructors. They happened to be functions that took in an argument and returned a value. `Number`, `isNaN`, `WebInspector.Foo.fromProtocol`.

Number is just weird in that it can be used with `new` but is even better when used without it =).