MCPcopy
hub / github.com/chartjs/Chart.js / sortByWeight

Function sortByWeight

src/core/core.layouts.js:18–26  ·  view source on GitHub ↗
(array, reverse)

Source from the content-addressed store, hash-verified

16}
17
18function sortByWeight(array, reverse) {
19 return array.sort((a, b) => {
20 const v0 = reverse ? b : a;
21 const v1 = reverse ? a : b;
22 return v0.weight === v1.weight ?
23 v0.index - v1.index :
24 v0.weight - v1.weight;
25 });
26}
27
28function wrapBoxes(boxes) {
29 const layoutBoxes = [];

Callers 1

buildLayoutBoxesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected