Closed
Bug 1260589
Opened 8 years ago
Closed 8 years ago
Add the ThreadSafeDevToolsUtils.flatten utility
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(firefox48 fixed)
RESOLVED
FIXED
Firefox 48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: fitzgen, Assigned: fitzgen)
References
Details
Attachments
(1 file, 1 obsolete file)
2.56 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
The `flatten` function takes an array of arrays and flattens them to a single array, removing one level of nesting. It does not recursively flatten multiple levels of nesting.
Assignee | ||
Comment 1•8 years ago
|
||
Attachment #8736069 -
Flags: review?(jsantell)
Assignee | ||
Updated•8 years ago
|
Assignee | ||
Comment 2•8 years ago
|
||
Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=fe212b807e13
Assignee | ||
Comment 3•8 years ago
|
||
Comment on attachment 8736069 [details] [diff] [review] Add the ThreadSafeDevToolsUtils.flatten utility Jordan is on PTO, so Jim gets another review!
Attachment #8736069 -
Flags: review?(jsantell) → review?(jimb)
Comment 4•8 years ago
|
||
Comment on attachment 8736069 [details] [diff] [review] Add the ThreadSafeDevToolsUtils.flatten utility Review of attachment 8736069 [details] [diff] [review]: ----------------------------------------------------------------- If the identities I suggest here are actually right, then perhaps it's best to just use the primitive that JS readers would be familiar with directly, instead of introducing new names for them. ::: devtools/shared/ThreadSafeDevToolsUtils.js @@ +248,5 @@ > + const length = inList.length; > + for (let i = 0; i < length; i++) { > + outList.push(inList[i]); > + } > + return outList; If this is required to mutate outList, then I think this is equivalent to outList.push.apply(inList). If only its return value matters and its arguments are consumed, then this is equivalent to outList.concat(inList). But I am not at all comfortable with the JS array operations, so check my claims. @@ +259,5 @@ > + * @param {Array<Array<Any>>} lists > + * @return {Array<Any>} > + */ > +exports.flatten = function(lists) { > + return lists.reduce(flattenReducer, []); I think this is just [].concat.apply(lists).
Attachment #8736069 -
Flags: review?(jimb) → review+
Assignee | ||
Comment 5•8 years ago
|
||
The `flatten` function takes an array of arrays and flattens them to a single array, removing one level of nesting. It does not recursively flatten multiple levels of nesting.
Attachment #8736385 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Attachment #8736069 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 6•8 years ago
|
||
We should probably just use lodash (or the subset that isn't covered by the ES spec) at some point
Assignee | ||
Comment 7•8 years ago
|
||
We should probably just use left-pad...
Assignee | ||
Comment 8•8 years ago
|
||
</snark> We should probably replace this with Array.prototype.flatten once SM implements it.
Comment 9•8 years ago
|
||
bugherder landing |
https://hg.mozilla.org/integration/fx-team/rev/1ac6445b0025
Keywords: checkin-needed
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1ac6445b0025
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•