export function minBy(array, selector) {
    let min = undefined;
    let minValue = undefined;
    for (const current of array) {
        const currentValue = selector(current);
        if (minValue === undefined || currentValue < minValue) {
            min = current;
            minValue = currentValue;
        }
    }
    return min;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWluX2J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsibWluX2J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVDQSxNQUFNLFVBQVUsS0FBSyxDQUNuQixLQUFtQixFQUNuQixRQUlxQjtJQUVyQixJQUFJLEdBQUcsR0FBa0IsU0FBUyxDQUFDO0lBQ25DLElBQUksUUFBUSxHQUE0QyxTQUFTLENBQUM7SUFFbEUsS0FBSyxNQUFNLE9BQU8sSUFBSSxLQUFLLEVBQUU7UUFDM0IsTUFBTSxZQUFZLEdBQUcsUUFBUSxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBRXZDLElBQUksUUFBUSxLQUFLLFNBQVMsSUFBSSxZQUFZLEdBQUcsUUFBUSxFQUFFO1lBQ3JELEdBQUcsR0FBRyxPQUFPLENBQUM7WUFDZCxRQUFRLEdBQUcsWUFBWSxDQUFDO1NBQ3pCO0tBQ0Y7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNiLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDb3B5cmlnaHQgMjAxOC0yMDIxIHRoZSBEZW5vIGF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuIE1JVCBsaWNlbnNlLlxuLy8gVGhpcyBtb2R1bGUgaXMgYnJvd3NlciBjb21wYXRpYmxlLlxuXG4vKipcbiAqIFJldHVybnMgdGhlIGZpcnN0IGVsZW1lbnQgdGhhdCBpcyB0aGUgc21hbGxlc3QgdmFsdWUgb2YgdGhlIGdpdmVuIGZ1bmN0aW9uIG9yIHVuZGVmaW5lZCBpZiB0aGVyZSBhcmUgbm8gZWxlbWVudHMuXG4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