Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2536)

Unified Diff: appengine/swarming/elements/res/js/common.js

Issue 2338383002: Refactor prior to adding task-page (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: Address nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/elements/res/js/common.js
diff --git a/appengine/swarming/elements/res/js/common.js b/appengine/swarming/elements/res/js/common.js
index 5789dac0d74e85c5570a03ba0ff48c5e5e0b9c35..64296f8d578a330d7b478700263b4a106d7118f0 100644
--- a/appengine/swarming/elements/res/js/common.js
+++ b/appengine/swarming/elements/res/js/common.js
@@ -6,6 +6,18 @@ this.swarming = this.swarming || function() {
var swarming = {};
+ // naturalCompare tries to use natural sorting (e.g. sort ints by value).
+ swarming.naturalCompare = function(a, b) {
+ // Try numeric, aka "natural" sort and use it if ns is not NaN.
+ // Javascript will try to corece these to numbers or return NaN.
+ var ns = a - b;
+ if (!isNaN(ns)) {
+ return ns;
+ }
+ return String(a).localeCompare(b);
+ };
+
+
swarming.stableSort = function(arr, comp) {
if (!arr || !comp) {
console.log("missing arguments to stableSort", arr, comp);
@@ -39,17 +51,6 @@ this.swarming = this.swarming || function() {
});
}
- // naturalCompare tries to use natural sorting (e.g. sort ints by value).
- swarming.naturalCompare = function(a, b) {
- // Try numeric, aka "natural" sort and use it if ns is not NaN.
- // Javascript will try to corece these to numbers or return NaN.
- var ns = a - b;
- if (!isNaN(ns)) {
- return ns;
- }
- return String(a).localeCompare(b);
- };
-
// postWithToast makes a post request and updates the error-toast
// element with the response, regardless of failure. See error-toast.html
// for more information.
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list-data.html ('k') | appengine/swarming/templates/public_bot_index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698