Closed
Bug 1468159
Opened 6 years ago
Closed 6 years ago
Convert lodash .union() to native ES6 JS
Categories
(Tree Management :: Treeherder: Frontend, enhancement, P3)
Tree Management
Treeherder: Frontend
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: evct, Assigned: evct, Mentored)
References
Details
Attachments
(1 file)
Converting all _.union() (lodash) functions to ES6 JS
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
Here's what I have in mind to replace _.union() with native ES6: const c = [2, 3, 3, 4]; const d = [1, 2, 3]; const uniondBis = Array.from(new Set([...c, ...d])); console.log(uniondBis); // [ 2, 3, 4, 1 ] Spreading syntax to merge the arrays. new Set() to remove duplicates. Array.from() to convert back to an Array.
Assignee | ||
Comment 2•6 years ago
|
||
Finally went with this syntax: const union = [...new Set([...c, ...d])];
Comment 3•6 years ago
|
||
Updated•6 years ago
|
Attachment #8985073 -
Flags: review?(cdawson)
Comment 4•6 years ago
|
||
Comment on attachment 8985073 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3655 Awaiting new updates.
Flags: needinfo?(cdawson)
Attachment #8985073 -
Flags: review?(cdawson)
Assignee | ||
Updated•6 years ago
|
Attachment #8985073 -
Flags: review?(cdawson)
Comment 5•6 years ago
|
||
Comment on attachment 8985073 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3655 Requested updates in the PR. Clearing review for now.
Flags: needinfo?(cdawson)
Attachment #8985073 -
Flags: review?(cdawson)
Updated•6 years ago
|
Flags: needinfo?(cdawson)
Updated•6 years ago
|
Flags: needinfo?(cdawson)
Assignee | ||
Comment 6•6 years ago
|
||
Comment on attachment 8985073 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3655 Request changes done.
Attachment #8985073 -
Flags: review?(cdawson)
Comment 7•6 years ago
|
||
Comment on attachment 8985073 [details] [review] Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3655 Comments in PR. Hit an error while testing.
Attachment #8985073 -
Flags: review?(cdawson) → review-
Comment 8•6 years ago
|
||
Actually, this is likely because this branch is based on a commit that had this error. Would you rebase and try again please?
Assignee | ||
Comment 9•6 years ago
|
||
I've rebased on last master and force pushed. As far as I have tested, no error when visiting the Alerts tab.
Assignee | ||
Updated•6 years ago
|
Attachment #8985073 -
Flags: review- → review?(cdawson)
Comment 10•6 years ago
|
||
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/1955db0588134e0de7138af82f06d4446b6a74d8 Bug 1468159 - convert _.union() usages to ES6 (#3655)
Updated•6 years ago
|
Attachment #8985073 -
Flags: review?(cdawson) → review+
Updated•6 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•