Closed Bug 1467435 Opened 6 years ago Closed 6 years ago

Convert lodash .map() to native ES6 JS

Categories

(Tree Management :: Treeherder: Frontend, defect, P3)

defect

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)
I will need some time to work on this since _.map() is used more than 60 times in the code.
Blocks: 1466494
Assignee: nobody → oss
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
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.
Proposed solution: Lodash: _.map(seriesToMeasure, 'platform') ES6: seriesToMeasure.map(serie => serie.platform)
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.
Attachment #8984182 - Flags: review?(cdawson)
Asked for updates in the PR.
Comment on attachment 8984182 [details] 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)
Attachment #8984182 - Flags: review?(cdawson)
Flags: needinfo?(cdawson)
Attachment #8984182 - Flags: review?(cdawson) → review+
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Depends on: 1470453
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: