[{value: 123, key: 15},{value: 321, key: 18},{value: 1232312, key: 17},{value: 5678, key: 24}]
const keySortPriorities = [15, 24, 17, 18];
[{value: 1232312, key: 17}, {value: 123, key: 15}]
.sort((a, b) => keySortPriorities.indexOf(a.key) - keySortPriorities.indexOf(b.key));
[{value: 123, key: 15},{value: 321, key: 18},{value: 1232312, key: 17},{value: 5678, key: 24}]
.sort((a, b) => keySortPriorities.indexOf(a.key) - keySortPriorities.indexOf(b.key))