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) { switch (checkRelation) {
default: default:
case 'contains': case 'contains':
re = new RegExp( re = new RegExp(checkClaim, 'gi')
checkClaim.replace('[', '\\[').replace(']', '\\]'), res.isVerified = re.test(proofData.replace(/\r?\n|\r|\\/g, ''))
'gi'
)
res.isVerified = re.test(proofData.replace(/\r?\n|\r/, ''))
break break
case 'equals': case 'equals':
res.isVerified = res.isVerified =
proofData.replace(/\r?\n|\r/, '').toLowerCase() == proofData.replace(/\r?\n|\r|\\/g, '').toLowerCase() ==
checkClaim.toLowerCase() checkClaim.toLowerCase()
break break
case 'oneOf': case 'oneOf':