From a3b7b3e63f997a7de1ec8826cbd57b2492bae2e5 Mon Sep 17 00:00:00 2001 From: Roger Floriano <31597636+petruki@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:22:27 -0700 Subject: [PATCH] chore: replaced in containsValue regex validation with includes (#484) --- src/helpers/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/helpers/index.js b/src/helpers/index.js index 194ae65..d5615e3 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -4,7 +4,6 @@ import { getDomainById } from '../services/domain'; import { getEnvironments } from '../services/environment'; import { getTeams } from '../services/team'; import { verifyPermissions, verifyPermissionsCascade } from './permission'; -import { some } from 'lodash'; const PATTERN_ALPHANUMERIC_SPACE = /^[a-zA-Z0-9_\- ]*$/; const PATTERN_ALPHANUMERIC = /^[a-zA-Z0-9_-]*$/; @@ -45,10 +44,15 @@ export function parseJSON(str) { } export function containsValue(arr, value) { - return some(arr, item => { - const regex = new RegExp(value); - return regex.test(item); - }); + if (!arr?.length) { + return false; + } + + for (const v of arr) { + if (v.includes(value)) { + return true; + } + } } export function formatInput(input,