UNPKG

strapi-plugin-users-permissions

Version:

Protect your API with a full-authentication process based on JWT

22 lines (17 loc) 557 B
import { sortBy } from 'lodash'; const createProvidersArray = data => { return sortBy( Object.keys(data).reduce((acc, current) => { const { icon: iconName, enabled, subdomain } = data[current]; const icon = iconName === 'envelope' ? ['fas', 'envelope'] : ['fab', iconName]; if (subdomain !== undefined) { acc.push({ name: current, icon, enabled, subdomain }); } else { acc.push({ name: current, icon, enabled }); } return acc; }, []), 'name' ); }; export default createProvidersArray;