mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Fix regex
This commit is contained in:
parent
c49cc20953
commit
f6738e978d
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ const runOnJson = (proofData, checkPath, checkClaim, checkRelation) => {
|
|||
switch (checkRelation) {
|
||||
default:
|
||||
case 'contains':
|
||||
re = new RegExp(checkClaim, "gi")
|
||||
re = new RegExp(checkClaim.replace('[', '\\[').replace(']', '\\]'), "gi")
|
||||
return re.test(proofData.replace(/\r?\n|\r/, ''))
|
||||
break
|
||||
case 'equals':
|
||||
|
@ -27,7 +27,7 @@ const runOnJson = (proofData, checkPath, checkClaim, checkRelation) => {
|
|||
if (Array.isArray(proofData)) {
|
||||
proofData.forEach((item, i) => {
|
||||
isVerified = isVerified || runOnJson(item, checkPath, checkClaim, checkRelation)
|
||||
});
|
||||
})
|
||||
} else if (Array.isArray(proofData[checkPath[0]])) {
|
||||
proofData[checkPath[0]].forEach((item, i) => {
|
||||
isVerified = isVerified || runOnJson(item, checkPath.slice(1), checkClaim, checkRelation)
|
||||
|
|
Loading…
Reference in a new issue