(array, value, score)
| 102 | } |
| 103 | |
| 104 | export function insertSorted(array, value, score) { |
| 105 | let pos = 0, priority = score(value) |
| 106 | while (pos < array.length && score(array[pos]) <= priority) pos++ |
| 107 | array.splice(pos, 0, value) |
| 108 | } |
| 109 | |
| 110 | function nothing() {} |
| 111 |