Skip to content

Commit

Permalink
Use isNonEmptyArray utility.
Browse files Browse the repository at this point in the history
  • Loading branch information
dompuiu committed Oct 28, 2024
1 parent 3eb772b commit d537f6f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/Personalization/createNotificationHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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,
Expand Down

0 comments on commit d537f6f

Please sign in to comment.