| 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.
|
|
|