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)
Tree Management
Treeherder: Frontend
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)
Reporter | ||
Updated•7 years ago
|
Assignee: nobody → oss
Status: NEW → ASSIGNED
Priority: -- → P3
Reporter | ||
Comment 1•7 years ago
|
||
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);
Reporter | ||
Comment 2•7 years ago
|
||
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.
Comment 3•7 years ago
|
||
Assignee | ||
Comment 4•7 years ago
|
||
(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])
Assignee | ||
Comment 5•7 years ago
|
||
Needs review. Commenting here, since the "details" section doesn't show me any suggested reviewers.
Updated•7 years ago
|
Assignee: oss → sarat.addepalli
Assignee | ||
Comment 6•7 years ago
|
||
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.
Updated•7 years ago
|
Attachment #8996623 -
Flags: review?(cdawson)
Comment 7•7 years ago
|
||
Awaiting rebase to resolve conflicts created when other PRs were merged.
Assignee | ||
Comment 8•7 years ago
|
||
Fixed conflicts after rebase, and pushed now.
Comment 9•7 years ago
|
||
Thanks for the updates. I'll review this on Friday.
Comment 10•7 years ago
|
||
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 11•7 years ago
|
||
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 12•7 years ago
|
||
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)
Updated•7 years ago
|
Attachment #8996623 -
Flags: review?(cdawson)
Comment hidden (obsolete) |
Updated•7 years ago
|
Attachment #8996623 -
Flags: review?(cdawson) → review+
Comment 14•7 years ago
|
||
Oh shoot, I accidentally merged the changes instead of squashing them. Ugh, sorry for the commit noise... :(
Updated•7 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Comment 15•7 years ago
|
||
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.
Comment 16•7 years ago
|
||
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.
Description
•