(array, value, score)
| 229 | } |
| 230 | |
| 231 | function insertSorted(array, value, score) { |
| 232 | var pos = 0, priority = score(value); |
| 233 | while (pos < array.length && score(array[pos]) <= priority) { pos++; } |
| 234 | array.splice(pos, 0, value); |
| 235 | } |
| 236 | |
| 237 | function nothing() {} |
| 238 |