<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Refactor BuildbotQueue.compareIterations and BuildbotQueue.compareIterationsByRevisions to be more generic"
href="https://bugs.webkit.org/show_bug.cgi?id=147667#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Refactor BuildbotQueue.compareIterations and BuildbotQueue.compareIterationsByRevisions to be more generic"
href="https://bugs.webkit.org/show_bug.cgi?id=147667">bug 147667</a>
from <span class="vcard"><a class="email" href="mailto:jmarcell@apple.com" title="Jason Marcell <jmarcell@apple.com>"> <span class="fn">Jason Marcell</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=147667#c2">comment #2</a>)
<span class="quote">> > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js:68
> > + _sortedItems: function(unsorted)
> > + {
> > + var sorted = [];
> > +
> > + for (var key in unsorted)
> > + sorted.push(unsorted[key]);
> > +
> > + sorted.sort(function(a, b) {
> > + return a.order - b.order;
> > + });
> > +
> > + return sorted;
>
> Please make this a free function. Additionally, the name of this function is
> disingenuous given the presence of its argument. Specifically the use of the
> past tense word "sorted" implies the function is a getter and/or sorts some
> kind of global data "items". But it takes an unsorted array as its argument
> and sorts this argument. Functions that perform a computation should have a
> name that begins with a verb. Maybe sortDictionaryByOrder()? Can we come up
> with a better name?</span >
Okay, but it's not really sorting a dictionary. It's really sorting an array of dictionaries or objects that happen to have an `order` key or property. Maybe `sortArrayByOrder` or `sortDictionariesByOrder` or `sortObjectsByOrder`?
Also, there is a Utilities.js file. Do you think this should go there?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>