mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Improve regex
This commit is contained in:
parent
b7cc0d4234
commit
b2503bfcab
1 changed files with 3 additions and 6 deletions
|
@ -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':
|
||||
|
|
Loading…
Reference in a new issue