const roles = [
{ name: 'role1', permissions: { a: true, b: true, c: true } },
{ name: 'role2', permissions: { a: true, b: true, c: false } },
{ name: 'role3', permissions: { a: true } },
];
const _ = require('lodash');
const rolePermissions = _.map(roles, role => _.pickBy(role.permissions));
const permissions = _.assign({}, ...rolePermissions);
console.log(permissions);