// ããã©ã«ãã®æ¯è¼é¢æ° function compare (a, b) { if (a === b) { return 0; } else if (a > b) { return 1; } else { return -1; } } function stableSort (array, fn) { if (fn == null) { fn = compare; } var i, len = array.length; if (len === 0) return array; // å¤ã¨ã¤ã³ããã¯ã¹ã®ãã¢ã«ãã for (i = 0; i < len; i++) { array[i] = [array[i], i]; } array.sort(function (p1, p2) { var cmp = fn(p1[0], p2[0]); if (cmp !== 0) { // ãã¢ã®0
{{#tags}}- {{label}}
{{/tags}}