MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / sortBy

Function sortBy

static/js/stats.js:100–116  ·  view source on GitHub ↗
(field, reverse, primer)

Source from the content-addressed store, hash-verified

98}
99
100var sortBy = function (field, reverse, primer) {
101 var key = primer
102 ? function (x) {
103 return primer(x[field])
104 }
105 : function (x) {
106 return x[field]
107 }
108
109 reverse = !reverse ? 1 : -1
110
111 return function (a, b) {
112 a = key(a)
113 b = key(b)
114 return reverse * ((a > b) - (b > a))
115 }
116}

Callers 1

countMarkersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected