Improve regex

This commit is contained in:
Yarmo Mackenbach 2020-11-20 19:40:20 +01:00
parent b7cc0d4234
commit b2503bfcab

View file

@ -45,15 +45,12 @@ const runVerificationJson = (
switch (checkRelation) {
default:
case 'contains':
re = new RegExp(
checkClaim.replace('[', '\\[').replace(']', '\\]'),
'gi'
)
res.isVerified = re.test(proofData.replace(/\r?\n|\r/, ''))
re = new RegExp(checkClaim, 'gi')
res.isVerified = re.test(proofData.replace(/\r?\n|\r|\\/g, ''))
break
case 'equals':
res.isVerified =
proofData.replace(/\r?\n|\r/, '').toLowerCase() ==
proofData.replace(/\r?\n|\r|\\/g, '').toLowerCase() ==
checkClaim.toLowerCase()
break
case 'oneOf':