Implement dropLast/takeLast

This commit is contained in:
2026-05-08 22:04:32 +02:00
parent 88baaebcf5
commit 8feefc24a7
28 changed files with 142 additions and 48 deletions

View File

@@ -3,8 +3,8 @@ import {error} from "../util/error";
export function minOf<T>(value: T[], transform: (it: T) => number): number {
if (value.length === 0) error();
let min = transform(value[0]);
for (let index = 1; index < value.length; index++) {
const it = value[index];
for (let i = 1; i < value.length; i++) {
const it = value[i];
const val = transform(it);
if (val < min) min = val;
}