* Returns the task with the minimal score based on the provided scoring * callback. * @param {function(!TaskDef):number} scorer * @return {?TaskDef}
(scorer)
| 106 | * @return {?TaskDef} |
| 107 | */ |
| 108 | peek(scorer) { |
| 109 | let minScore = 1e6; |
| 110 | let minTask = null; |
| 111 | for (let i = 0; i < this.tasks_.length; i++) { |
| 112 | const task = this.tasks_[i]; |
| 113 | const score = scorer(task); |
| 114 | if (score < minScore) { |
| 115 | minScore = score; |
| 116 | minTask = task; |
| 117 | } |
| 118 | } |
| 119 | return minTask; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Iterates over all tasks in queue in the insertion order. |
no outgoing calls
no test coverage detected