📅  最后修改于: 2022-03-11 15:01:38.604000             🧑  作者: Mango
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);