// Copyright (c) ppy Pty Ltd . Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. export function mapBy(array: T[], key: K) { const map = new Map(); for (const value of array) { map.set(value[key], value); } return map; } export function mapByWithNulls(array: T[], key: K) { const map = new Map(); for (const value of array) { map.set(value[key], value); } return map; }