From d537f6f4a980089b67520db483edf310aa65f359 Mon Sep 17 00:00:00 2001 From: Serban Stancu Date: Mon, 28 Oct 2024 13:42:24 -0600 Subject: [PATCH] Use isNonEmptyArray utility. --- .../Personalization/createNotificationHandler.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/Personalization/createNotificationHandler.js b/src/components/Personalization/createNotificationHandler.js index cd5a6837d..c8f65333e 100644 --- a/src/components/Personalization/createNotificationHandler.js +++ b/src/components/Personalization/createNotificationHandler.js @@ -11,6 +11,7 @@ governing permissions and limitations under the License. */ import { defer } from "../../utils/index.js"; import { SUPPRESS } from "../../constants/eventType.js"; +import isNonEmptyArray from "../../utils/isNonEmptyArray.js"; export default (collect, renderedPropositions) => { return (isRenderDecisions, isSendDisplayEvent, viewName) => { @@ -26,20 +27,14 @@ export default (collect, renderedPropositions) => { } return (decisionsMetaDisplay = [], decisionsMetaSuppressed = []) => { - if ( - Array.isArray(decisionsMetaDisplay) && - decisionsMetaDisplay.length > 0 - ) { + if (isNonEmptyArray(decisionsMetaDisplay)) { collect({ decisionsMeta: decisionsMetaDisplay, viewName, }); } - if ( - Array.isArray(decisionsMetaSuppressed) && - decisionsMetaSuppressed.length > 0 - ) { + if (isNonEmptyArray(decisionsMetaSuppressed)) { collect({ decisionsMeta: decisionsMetaSuppressed, eventType: SUPPRESS,