Closed
Bug 1467435
Opened 7 years ago
Closed 7 years ago
Convert lodash .map() to native ES6 JS
Categories
(Tree Management :: Treeherder: Frontend, defect, P3)
Tree Management
Treeherder: Frontend
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: evct, Assigned: evct)
References
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36 OPR/53.0.2907.68
Steps to reproduce:
Converting all _.map() (lodash) functions to native .map() (ES6 JS)
Assignee | ||
Comment 1•7 years ago
|
||
I will need some time to work on this since _.map() is used more than 60 times in the code.
Updated•7 years ago
|
Assignee: nobody → oss
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Assignee | ||
Comment 2•7 years ago
|
||
Just for memo:
Lodash: _.map(array, iteratee);
ES6: array.map(iteratee);
Most of the time, iteratee is a method to transform the keys.
But Lodash provides a shorthand to directly pass a property name as iteratee (under the hood, it uses _.property()).
Each time we need to convert this shorthand to ES6, we will need to create an anonymous function returning the property we want.
Assignee | ||
Comment 3•7 years ago
|
||
Proposed solution:
Lodash: _.map(seriesToMeasure, 'platform')
ES6: seriesToMeasure.map(serie => serie.platform)
Assignee | ||
Comment 4•7 years ago
|
||
Ok I found that some calls of _.map() are done on Objects.
However the ES6 native .map() method is an Array method. I will skip those cases.
Comment 5•7 years ago
|
||
Updated•7 years ago
|
Attachment #8984182 -
Flags: review?(cdawson)
Comment 6•7 years ago
|
||
Asked for updates in the PR.
Comment 7•7 years ago
|
||
Comment on attachment 8984182 [details] [review]
Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3632
Clearing review till updates come in. But need-info'ing myself to keep it on my radar. :)
Flags: needinfo?(cdawson)
Attachment #8984182 -
Flags: review?(cdawson)
Updated•7 years ago
|
Attachment #8984182 -
Flags: review?(cdawson)
Updated•7 years ago
|
Flags: needinfo?(cdawson)
Comment 8•7 years ago
|
||
Commit pushed to master at https://github.com/mozilla/treeherder
https://github.com/mozilla/treeherder/commit/68d635fabb18e5d9bb46bd67edbf023624f6b277
Bug 1467435 - convert _.map() usages to ES6 (#3632)
Updated•7 years ago
|
Attachment #8984182 -
Flags: review?(cdawson) → review+
Updated•7 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•