@ -32,6 +32,14 @@ const executeComparison =
|
|||||||
if (isNotDefined(comparison.comparisonOperator)) return false
|
if (isNotDefined(comparison.comparisonOperator)) return false
|
||||||
switch (comparison.comparisonOperator) {
|
switch (comparison.comparisonOperator) {
|
||||||
case ComparisonOperators.CONTAINS: {
|
case ComparisonOperators.CONTAINS: {
|
||||||
|
if (Array.isArray(inputValue)) {
|
||||||
|
const equal = (a: string | null, b: string | null) => {
|
||||||
|
if (typeof a === 'string' && typeof b === 'string')
|
||||||
|
return a.normalize() === b.normalize()
|
||||||
|
return a !== b
|
||||||
|
}
|
||||||
|
return compare(equal, inputValue, value, 'some')
|
||||||
|
}
|
||||||
const contains = (a: string | null, b: string | null) => {
|
const contains = (a: string | null, b: string | null) => {
|
||||||
if (b === '' || !b || !a) return false
|
if (b === '' || !b || !a) return false
|
||||||
return a
|
return a
|
||||||
@ -43,6 +51,14 @@ const executeComparison =
|
|||||||
return compare(contains, inputValue, value, 'some')
|
return compare(contains, inputValue, value, 'some')
|
||||||
}
|
}
|
||||||
case ComparisonOperators.NOT_CONTAINS: {
|
case ComparisonOperators.NOT_CONTAINS: {
|
||||||
|
if (Array.isArray(inputValue)) {
|
||||||
|
const notEqual = (a: string | null, b: string | null) => {
|
||||||
|
if (typeof a === 'string' && typeof b === 'string')
|
||||||
|
return a.normalize() !== b.normalize()
|
||||||
|
return a !== b
|
||||||
|
}
|
||||||
|
return compare(notEqual, inputValue, value, 'some')
|
||||||
|
}
|
||||||
const notContains = (a: string | null, b: string | null) => {
|
const notContains = (a: string | null, b: string | null) => {
|
||||||
if (b === '' || !b || !a) return true
|
if (b === '' || !b || !a) return true
|
||||||
return !a
|
return !a
|
||||||
|
Reference in New Issue
Block a user