mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49: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) {
|
switch (checkRelation) {
|
||||||
default:
|
default:
|
||||||
case 'contains':
|
case 'contains':
|
||||||
re = new RegExp(checkClaim, "gi")
|
re = new RegExp(checkClaim.replace('[', '\\[').replace(']', '\\]'), "gi")
|
||||||
return re.test(proofData.replace(/\r?\n|\r/, ''))
|
return re.test(proofData.replace(/\r?\n|\r/, ''))
|
||||||
break
|
break
|
||||||
case 'equals':
|
case 'equals':
|
||||||
|
@ -27,7 +27,7 @@ const runOnJson = (proofData, checkPath, checkClaim, checkRelation) => {
|
||||||
if (Array.isArray(proofData)) {
|
if (Array.isArray(proofData)) {
|
||||||
proofData.forEach((item, i) => {
|
proofData.forEach((item, i) => {
|
||||||
isVerified = isVerified || runOnJson(item, checkPath, checkClaim, checkRelation)
|
isVerified = isVerified || runOnJson(item, checkPath, checkClaim, checkRelation)
|
||||||
});
|
})
|
||||||
} else if (Array.isArray(proofData[checkPath[0]])) {
|
} else if (Array.isArray(proofData[checkPath[0]])) {
|
||||||
proofData[checkPath[0]].forEach((item, i) => {
|
proofData[checkPath[0]].forEach((item, i) => {
|
||||||
isVerified = isVerified || runOnJson(item, checkPath.slice(1), checkClaim, checkRelation)
|
isVerified = isVerified || runOnJson(item, checkPath.slice(1), checkClaim, checkRelation)
|
||||||
|
|
Loading…
Reference in a new issue