Skip to content

Commit

Permalink
simplify validateIn
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomociti committed Apr 15, 2024
1 parent 0de98db commit 8e8cfe8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@rdfjs/dataset": "^2",
"@rdfjs/environment": "^1",
"@rdfjs/namespace": "^2.0.0",
"@rdfjs/term-map": "^2.0.1",
"@rdfjs/term-set": "^2.0.1",
"@vocabulary/sh": "^1.0.1",
"clownface": "^2.0.0",
Expand Down
12 changes: 4 additions & 8 deletions src/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,11 @@ function validateHasValueProperty(context, focusNode, valueNode, constraint) {

function validateIn(context, focusNode, valueNode, constraint) {
const { sh } = context.ns
const inNode = constraint.getParameterValue(sh.in)
if (!constraint.nodeSets) {
constraint.nodeSets = new TermMap()
}
let nodeSet = constraint.nodeSets.get(inNode)
if (!nodeSet) {
nodeSet = new NodeSet(rdfListToArray(context.$shapes.node(inNode)))
constraint.nodeSets.set(inNode, nodeSet)
if (!constraint.nodeSet) {
const inNode = constraint.getParameterValue(sh.in)
constraint.nodeSet = new NodeSet(rdfListToArray(context.$shapes.node(inNode)))
}
const { nodeSet } = constraint

return nodeSet.has(valueNode)
}
Expand Down

0 comments on commit 8e8cfe8

Please sign in to comment.