(items: typeof candidates)
| 266 | ) |
| 267 | |
| 268 | const pick = (items: typeof candidates) => { |
| 269 | const maxCost = Math.max(...items.map((item) => item.cost), 0.01) |
| 270 | const maxAge = Math.max(...items.map((item) => item.age), 0.01) |
| 271 | return pipe( |
| 272 | items, |
| 273 | Array.sortWith((item) => (item.cost / maxCost) * 0.8 + (item.age / maxAge) * 0.2, Order.Number), |
| 274 | Array.map((item) => projectModel(item.model, provider)), |
| 275 | Array.head, |
| 276 | ) |
| 277 | } |
| 278 | |
| 279 | return Option.getOrUndefined( |
| 280 | pipe( |
no test coverage detected