Skip to content

Commit

Permalink
Fixing bug that was fixed in v2
Browse files Browse the repository at this point in the history
  • Loading branch information
manchicken committed Apr 19, 2024
1 parent 4d76927 commit cb6116d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/org-rules.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const selectionForTags = (tags, serviceDefinition) => {

const caseSensitiveFieldListMatch =
(fieldName) => (value, serviceDefinition) => {
if (value.toLocaleLowerCase() === 'all') {
if (value?.toLocaleLowerCase() === 'all') {
!!_.get(serviceDefinition, fieldName, undefined)
}
if (!Array.isArray(value)) {
Expand All @@ -210,7 +210,7 @@ const caseSensitiveFieldListMatch =
* @function
**/
const caseInsensitiveFieldMatch = (fieldName) => (value, serviceDefinition) =>
value.toLocaleLowerCase() ===
value?.toLocaleLowerCase() ===
serviceDefinition?.[fieldName]?.toLocaleLowerCase()

/**
Expand Down Expand Up @@ -239,7 +239,7 @@ const determineApplicabilityOfRule = (rule, serviceDescription) => {

if (!selectionCriteria) return false

if (`${selectionCriteria}`.toLocaleLowerCase() === 'all') return true
if (`${selectionCriteria}`?.toLocaleLowerCase() === 'all') return true

// Find all of the criteria which fail.
const failingCriteria = _.filter(selectionCriteria, (value, key) => {
Expand Down Expand Up @@ -330,7 +330,7 @@ const makeComplianceCheck_valueMatchAndCount = (
if (
permittedValues.length &&
!sd_list.find((value) =>
_.includes(permittedValues, matchField_sd(value).toLocaleLowerCase()),
_.includes(permittedValues, matchField_sd(value)?.toLocaleLowerCase()),
)
) {
return false
Expand All @@ -355,7 +355,7 @@ const makeSimpleStringFieldComplianceChecker =
// Support `any`
if (
!Array.isArray(requirement) &&
requirement.toLocaleLowerCase() === 'any'
requirement?.toLocaleLowerCase() === 'any'
) {
return !!_.get(serviceDefinition, fieldName, undefined)
}
Expand Down

0 comments on commit cb6116d

Please sign in to comment.