function prepareGroups(groups) {
        return Object.keys(groups).reduce((acc, key) => {
            // Include contacts that were selected, or deleted.
            const selected = groups[key].filter(({ selected }) => selected);
            const deleted = groups[key].filter(({ deleted }) => deleted);

            // If less than 2 contacts were selected, and there is nothing to delete, ignore this group.
            if (selected.length <= 1 && deleted.length === 0) {
                return acc;
            }
            acc[key] = { selected, deleted };
            return acc;
        }, {});
    }
/**
     * Mangle the groups of contacts into selected and delected.
     * @param {Object} groups Coming from the contact-merge directive.
     * @returns {{}}
     */
Mangle the groups of contacts into selected and delected.
@param {Object} groups Coming from the contact-merge directive.
Mangle the groups of contacts into selected and delected . @param { Object } groups Coming from the contact - merge directive .
function prepareGroups(groups) {
        return Object.keys(groups).reduce((acc, key) => {
            const selected = groups[key].filter(({ selected }) => selected);
            const deleted = groups[key].filter(({ deleted }) => deleted);
            if (selected.length <= 1 && deleted.length === 0) {
                return acc;
            }
            acc[key] = { selected, deleted };
            return acc;
        }, {});
    }
function prepareGroups ( groups ) { return Object . keys ( groups ) . reduce ( ( acc , key ) => { const selected = groups [ key ] . filter ( ( { selected } ) => selected ) ; const deleted = groups [ key ] . filter ( ( { deleted } ) => deleted ) ; if ( selected . length <= 1 && deleted . length === 0 ) { return acc ; } acc [ key ] = { selected , deleted } ; return acc ; } , { } ) ; }
Mangle the groups of contacts into selected and delected.
Mangle the groups of contacts into selected and delected .
// Include contacts that were selected, or deleted. // If less than 2 contacts were selected, and there is nothing to delete, ignore this group.