List of utility methods to do Object Sort
ksort(obj)function ksort(obj) { if (!obj || typeof (obj) != 'object') { return []; var keys = [], values = []; for (var i in obj) { keys.push(i); keys.sort(); ... | |
sortByValue(toSort)function sortByValue(toSort) { var keys = Object.keys(toSort); keys.sort(function(a, b) { return toSort[a] < toSort[b] ? -1 : (toSort[a] === toSort[b] ? 0 : 1); }); return keys; |