From d3da03c099b2de7ea4fde9da80c0dd2e09e6b75a Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Fri, 17 Mar 2023 13:52:44 +0100 Subject: [PATCH] Helper-Plugin: Optimize lodash imports --- .../utils/contentManagementUtilRemoveFieldsFromData.js | 3 ++- packages/core/helper-plugin/lib/src/utils/auth/index.js | 2 +- .../core/helper-plugin/lib/src/utils/hasPermissions/index.js | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/helper-plugin/lib/src/content-manager/utils/contentManagementUtilRemoveFieldsFromData.js b/packages/core/helper-plugin/lib/src/content-manager/utils/contentManagementUtilRemoveFieldsFromData.js index 275d1544d8..54cf1061f1 100644 --- a/packages/core/helper-plugin/lib/src/content-manager/utils/contentManagementUtilRemoveFieldsFromData.js +++ b/packages/core/helper-plugin/lib/src/content-manager/utils/contentManagementUtilRemoveFieldsFromData.js @@ -1,4 +1,5 @@ -import { get } from 'lodash'; +import get from 'lodash/get'; + import { getType, getOtherInfos } from './getAttributeInfos'; const defaultFields = ['createdBy', 'updatedBy', 'publishedAt', 'id', '_id']; diff --git a/packages/core/helper-plugin/lib/src/utils/auth/index.js b/packages/core/helper-plugin/lib/src/utils/auth/index.js index 9bd494e169..babcbdda62 100644 --- a/packages/core/helper-plugin/lib/src/utils/auth/index.js +++ b/packages/core/helper-plugin/lib/src/utils/auth/index.js @@ -1,6 +1,6 @@ // TODO @soupette we need to refactor this file -import { isNil } from 'lodash'; +import isNil from 'lodash/isNil'; import isEmpty from 'lodash/isEmpty'; const TOKEN_KEY = 'jwtToken'; diff --git a/packages/core/helper-plugin/lib/src/utils/hasPermissions/index.js b/packages/core/helper-plugin/lib/src/utils/hasPermissions/index.js index 200b0d8438..080bd208a2 100644 --- a/packages/core/helper-plugin/lib/src/utils/hasPermissions/index.js +++ b/packages/core/helper-plugin/lib/src/utils/hasPermissions/index.js @@ -1,4 +1,7 @@ -import { isEmpty, pickBy, transform } from 'lodash'; +import isEmpty from 'lodash/isEmpty'; +import pickBy from 'lodash/pickBy'; +import transform from 'lodash/transform'; + import request from '../request'; const findMatchingPermissions = (userPermissions, permissions) => {