Every line of 'javascript sort list' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
120 function sort(list) { 121 return list.sort(function(a, b) { 122 var cmp = (b.order || 0) - (a.order || 0); 123 return cmp || a.name && a.name.localeCompare(b.name); 124 }) 125 }
146 function sortList(list, sortBy) 147 { 148 return list.sort(function (a, b) 149 { 150 return a[sortBy] - b[sortBy]; 151 }); 152 }
40 sortList(e: ISortableEvent): void { 41 this.items = e.sort(this.items); 42 }
833 function js_listsort( ind, obj ) 834 { 835 Scope.params.p = 1; 836 if ( ind == 0xffff || ind == 0xfffe) 837 Scope.params.sort = ind == Math.abs( Scope.params.sort ) ? -Scope.params.sort : ind; 838 else 839 Scope.params.sort = Scope.collist[ind].id == Math.abs( Scope.params.sort ) ? -Scope.params.sort : Scope.collist[ind].id; 840 Scope.update( false ); 841 return false; 842 }
9 function sortList(list, isDes = false, property) { 10 if (property) { 11 if ((typeof list[0][property]).toLowerCase() === 'number') { 12 return list.sort((a, b) => { 13 return isDes 14 ? b[property] - a[property] 15 : a[property] - b[property] 16 }) 17 } else { 18 return list.sort((a, b) => { 19 return isDes 20 ? new Date(b[property]).getTime() - new Date(a[property]).getTime() 21 : new Date(a[property]).getTime() - new Date(b[property]).getTime() 22 }) 23 } 24 } else { 25 return list.sort((a, b) => { 26 return isDes 27 ? b - a 28 : a - b 29 }) 30 } 31 }
33 function sortList(sortOption){ 34 window.jobList.sort(function(job1, job2){ 35 if (sortOption=="runName"){ 36 if (job1["runName"]>job2["runName"]) return 1; 37 if(job1["runName"]
716 function sort(array) { 717 return array.sort(sortFn); 718 }
229 function sort(array) { return array.sort(sortFn); }
57 static sortByField(list, field, dir) { 58 if (!list || !list.sort) { return false; } 59 60 const dirX = (dir && dir === 'desc')? -1 : 1; 61 list.sort(function(a, b) { 62 const a_val = a[field]; 63 const b_val = b[field]; 64 65 if (typeof b_val === 'undefined') { 66 return (typeof a_val === 'undefined')? 0 : 1 * dirX; 67 } 68 69 if (typeof a_val === 'undefined') { 70 return -1 * dirX; 71 } 72 73 if (a_val < b_val) { return -1 * dirX; } 74 if (a_val > b_val) { return 1 * dirX; } 75 76 return 0; 77 }); 78 79 return true; 80 }
7 function sort(object) { 8 if (sortArrays === true && Array.isArray(object)) { 9 return object.sort(); 10 } 11 else if (typeof object !== "object" || object === null) { 12 return object; 13 } 14 15 return Object.keys(object).sort().map(function(key) { 16 return { 17 key: key, 18 value: sort(object[key]) 19 }; 20 }); 21 }