export function findDuplicateIndices(array, key) {
    const indicesByValue = new Map();
    for (let i = 0; i < array.length; i++) {
        const value = array[i][key];
        const indices = indicesByValue.get(value) ?? [];
        indices.push(i);
        indicesByValue.set(value, indices);
    }
    const result = [];
    for (const [value, indices] of indicesByValue) {
        if (indices.length > 1) {
            result.push([value, indices]);
        }
    }
    return result;
}
export function pushErrors(errors, error) {
    if (error) {
        if (Array.isArray(error)) {
            if (error.length) {
                errors.push(...error);
            }
        }
        else {
            errors.push(error);
        }
    }
}
