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

Side by Side Diff: appengine/swarming/elements/res/js/common.js

Issue 2269643002: Extract shared filters and aliasing code (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Address nit Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « appengine/swarming/elements/res/js/alias.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 this.swarming = this.swarming || function() { 5 this.swarming = this.swarming || function() {
6 6
7 var swarming = {}; 7 var swarming = {};
8 8
9 swarming.stableSort = function(arr, comp) { 9 swarming.stableSort = function(arr, comp) {
10 if (!arr || !comp) { 10 if (!arr || !comp) {
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 // naturalCompare tries to use natural sorting (e.g. sort ints by value). 42 // naturalCompare tries to use natural sorting (e.g. sort ints by value).
43 swarming.naturalCompare = function(a, b) { 43 swarming.naturalCompare = function(a, b) {
44 // Try numeric, aka "natural" sort and use it if ns is not NaN. 44 // Try numeric, aka "natural" sort and use it if ns is not NaN.
45 // Javascript will try to corece these to numbers or return NaN. 45 // Javascript will try to corece these to numbers or return NaN.
46 var ns = a - b; 46 var ns = a - b;
47 if (!isNaN(ns)) { 47 if (!isNaN(ns)) {
48 return ns; 48 return ns;
49 } 49 }
50 return a.localeCompare(b); 50 return String(a).localeCompare(b);
51 }; 51 };
52 52
53 return swarming; 53 return swarming;
54 }(); 54 }();
OLDNEW
« no previous file with comments | « appengine/swarming/elements/res/js/alias.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698