Bug 149333

Summary: Web Inspector: Simplify some functional callbacks
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: DoNotImportToRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2015-09-17 21:23:10 PDT
Simplify some functional callbacks.

We have a few cases of:

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

Which can just be:

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


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 =).