export function groupBy(array, selector) {
    const ret = {};
    for (const element of array) {
        const key = selector(element);
        if (ret[key] === undefined) {
            ret[key] = [element];
            continue;
        }
        ret[key].push(element);
    }
    return ret;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JvdXBfYnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJncm91cF9ieS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE4QkEsTUFBTSxVQUFVLE9BQU8sQ0FDckIsS0FBbUIsRUFDbkIsUUFBMkI7SUFFM0IsTUFBTSxHQUFHLEdBQXdCLEVBQUUsQ0FBQztJQUVwQyxLQUFLLE1BQU0sT0FBTyxJQUFJLEtBQUssRUFBRTtRQUMzQixNQUFNLEdBQUcsR0FBRyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFOUIsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssU0FBUyxFQUFFO1lBQzFCLEdBQUcsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1lBRXJCLFNBQVM7U0FDVjtRQUVELEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7S0FDeEI7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNiLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDb3B5cmlnaHQgMjAxOC0yMDIxIHRoZSBEZW5vIGF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuIE1JVCBsaWNlbnNlLlxuLy8gVGhpcyBtb2R1bGUgaXMgYnJvd3NlciBjb21wYXRpYmxlLlxuXG4vKipcbiAqIEFwcGxpZXMgdGhlIGdpdmVuIHNlbGVjdG9yIHRvIGVhY2ggZWxlbWVudCBpbiB0aGUgZ2l2ZW4gYXJyYXksIHJldHVybmluZyBhIFJlY29yZCBjb250YWluaW5nIH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