MCPcopy Index your code
hub / github.com/plotly/plotly.js / getSortFunc

Function getSortFunc

src/transforms/sort.js:127–154  ·  view source on GitHub ↗
(opts, d2c)

Source from the content-addressed store, hash-verified

125}
126
127function getSortFunc(opts, d2c) {
128 switch(opts.order) {
129 case 'ascending':
130 return function(a, b) {
131 var ac = d2c(a.v);
132 var bc = d2c(b.v);
133 if(ac === BADNUM) {
134 return 1;
135 }
136 if(bc === BADNUM) {
137 return -1;
138 }
139 return ac - bc;
140 };
141 case 'descending':
142 return function(a, b) {
143 var ac = d2c(a.v);
144 var bc = d2c(b.v);
145 if(ac === BADNUM) {
146 return 1;
147 }
148 if(bc === BADNUM) {
149 return -1;
150 }
151 return bc - ac;
152 };
153 }
154}

Callers 1

getIndicesFunction · 0.85

Calls 1

d2cFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…