MCPcopy Index your code
hub / github.com/phaserjs/phaser / StableSort

Function StableSort

src/utils/array/StableSort.js:157–181  ·  view source on GitHub ↗
(array, compare)

Source from the content-addressed store, hash-verified

155 * @return {array} The sorted result.
156 */
157var StableSort = function (array, compare)
158{
159 if (compare === undefined) { compare = Compare; }
160
161 // Short-circuit when there's nothing to sort.
162 if (!array || array.length < 2)
163 {
164 return array;
165 }
166
167 if (Device.features.stableSort)
168 {
169 return array.sort(compare);
170 }
171
172 var result = Process(array, compare);
173
174 // This simply copies back if the result isn't in the original array, which happens on an odd number of passes.
175 if (result !== array)
176 {
177 RunPass(result, null, array.length, array);
178 }
179
180 return array;
181};
182
183module.exports = StableSort;

Callers 6

DisplayList.jsFile · 0.85
LightsManager.jsFile · 0.85
Layer.jsFile · 0.85
ParticleEmitter.jsFile · 0.85
List.jsFile · 0.85
StableSort.test.jsFile · 0.85

Calls 2

ProcessFunction · 0.85
RunPassFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…