lib/config/config-rule.js
function groupByProperty(objects) {
    const groupedObj = objects.reduce((accumulator, obj) => {
        const prop = Object.keys(obj)[0];

        accumulator[prop] = accumulator[prop] ? accumulator[prop].concat(obj) : [obj];
        return accumulator;
    }, {});

    return Object.keys(groupedObj).map(prop => groupedObj[prop]);
}
function groupByProperty(objects) {
    const groupedObj = objects.reduce((accumulator, obj) => {
        const prop = Object.keys(obj)[0];

        accumulator[prop] = accumulator[prop] ? accumulator[prop].concat(obj) : [obj];
        return accumulator;
    }, {});

    return Object.keys(groupedObj).map(prop => groupedObj[prop]);
}
function groupByProperty ( objects ) { const groupedObj = objects . reduce ( ( accumulator , obj ) => { const prop = Object . keys ( obj ) [ 0 ] ; accumulator [ prop ] = accumulator [ prop ] ? accumulator [ prop ] . concat ( obj ) : [ obj ] ; return accumulator ; } , { } ) ; return Object . keys ( groupedObj ) . map ( prop => groupedObj [ prop ] ) ; }
Group together valid rule configurations based on object properties

e.g.:
groupByProperty([
{before: true},
{before: false},
{after: true},
{after: false}
]);

will return:
[
[{before: true}, {before: false}],
[{after: true}, {after: false}]
]

@param   {Object[]} objects Array of objects, each with one property/value pair
@returns {Array[]}          Array of arrays of objects grouped by property
Group together valid rule configurations based on object properties