Closed Bug 1468160 Opened 7 years ago Closed 7 years ago

Convert lodash .max() to native ES6 JS

Categories

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

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: evct, Assigned: SirR4T, Mentored)

References

Details

Attachments

(1 file)

Converting all _.max() (lodash) functions to Math.max() (ES6 JS)
Assignee: nobody → oss
Status: NEW → ASSIGNED
Priority: -- → P3
I plan on taking advantage of the spreading operator to use Math.max(): const arr = [2, 3, 8]; const max = Math.max( ...arr ); console.log(max);
Blocks: 1466494
Ok looks like _.max() is mostly used to compare Date objects... Math.max() is going to be useless here. Have to reconsider this one and Bug 1468161.
(In reply to Eliott Vincent [:evct] (GMT+2) from comment #2) > Ok looks like _.max() is mostly used to compare Date objects... > Math.max() is going to be useless here. Have to reconsider this one and Bug > 1468161. I've resorted to doing the below: [dateObj1, dateObj2, dateObj3].reduce((a, b) => (a > b ? a : b)) in place of: _.max([dateObj1, dateObj2, dateObj3])
Needs review. Commenting here, since the "details" section doesn't show me any suggested reviewers.
Assignee: oss → sarat.addepalli
Hi Ed, I could see that you marked the GitHub PR for review by :camd, but i was wondering why the Bugzilla bug's review flag wasn't updated. Hope that will not be an issue in workflows for anyone.
Attachment #8996623 - Flags: review?(cdawson)
Awaiting rebase to resolve conflicts created when other PRs were merged.
Fixed conflicts after rebase, and pushed now.
Thanks for the updates. I'll review this on Friday.
Comment on attachment 8996623 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3858 Asked for changes in the PR.
Attachment #8996623 - Flags: review?(cdawson)
Comment on attachment 8996623 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3858 Reassigning to myself awaiting requested changes.
Attachment #8996623 - Flags: review?(cdawson)
Comment on attachment 8996623 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3858 Unassigning for now till there are updates. Sirat, please comment in the PR when you've made the changes. Thanks!! :)
Attachment #8996623 - Flags: review?(cdawson)
Attachment #8996623 - Flags: review?(cdawson)
Attachment #8996623 - Flags: review?(cdawson) → review+
Oh shoot, I accidentally merged the changes instead of squashing them. Ugh, sorry for the commit noise... :(
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/af7e94cfdb996ab4f76c93bd1f0c893ab357e19b Bug 1468160 - Convert _.max to use native ES6 JS (#3858) Two instances have been left using lodash for now, since `Math.max()` does not preserve `Date()` objects unlike lodash. These cases have been converted to use the tree-shaking compatible import form.
I've squashed the commits on master and force pushed to update, since nothing else had been committed since :-)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: