export function maxOf(array, selector) {
    let maximumValue = undefined;
    for (const i of array) {
        const currentValue = selector(i);
        if (maximumValue === undefined || currentValue > maximumValue) {
            maximumValue = currentValue;
            continue;
        }
        if (Number.isNaN(currentValue)) {
            return currentValue;
        }
    }
    return maximumValue;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF4X29mLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsibWF4X29mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDQSxNQUFNLFVBQVUsS0FBSyxDQUNuQixLQUFtQixFQUNuQixRQUFXO0lBRVgsSUFBSSxZQUFZLEdBQThCLFNBQVMsQ0FBQztJQUV4RCxLQUFLLE1BQU0sQ0FBQyxJQUFJLEtBQUssRUFBRTtRQUNyQixNQUFNLFlBQVksR0FBRyxRQUFRLENBQUMsQ0FBQyxDQUFrQixDQUFDO1FBRWxELElBQUksWUFBWSxLQUFLLFNBQVMsSUFBSSxZQUFZLEdBQUcsWUFBWSxFQUFFO1lBQzdELFlBQVksR0FBRyxZQUFZLENBQUM7WUFDNUIsU0FBUztTQUNWO1FBRUQsSUFBSSxNQUFNLENBQUMsS0FBSyxDQUFDLFlBQVksQ0FBQyxFQUFFO1lBQzlCLE9BQU8sWUFBWSxDQUFDO1NBQ3JCO0tBQ0Y7SUFFRCxPQUFPLFlBQVksQ0FBQztBQUN0QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IDIwMTgtMjAyMSB0aGUgRGVubyBhdXRob3JzLiBBbGwgcmlnaHRzIHJlc2VydmVkLiBNSVQgbGljZW5zZS5cbi8vIFRoaXMgbW9kdWxlIGlzIGJyb3dzZXIgY29tcGF0aWJsZS5cblxuLyoqXG4gKiBBcHBsaWVzIHRoZSBnaXZlbiBzZWxlY3RvciB0byBhbGwgZWxlbWVudHMgb2YgdGhlIGdpdmVuIGNvbGxlY3Rpb24gYW5kXG4gK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