Comparing version 0.12.2 to 0.12.3
@@ -79,5 +79,13 @@ const rdf = require('@rdfjs/data-model') | ||
const value = item.out(this.namespace.first) | ||
if (value.terms.length > 1) { | ||
throw new Error(`Invalid list: multiple values for rdf:first on ${item.value}`) | ||
} | ||
item = item.out(this.namespace.rest) | ||
const rest = item.out(this.namespace.rest) | ||
if (rest.terms.length > 1) { | ||
throw new Error(`Invalid list: multiple values for rdf:rest on ${item.value}`) | ||
} | ||
item = rest | ||
return { done: false, value } | ||
@@ -84,0 +92,0 @@ } |
{ | ||
"name": "clownface", | ||
"version": "0.12.2", | ||
"version": "0.12.3", | ||
"description": "Simple but powerful graph traversing library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -73,2 +73,35 @@ /* global describe, it */ | ||
}) | ||
it('should throw when a list node has multiple rdf:first', () => { | ||
const start = rdf.blankNode() | ||
const listNode = rdf.blankNode() | ||
const dataset = rdf.dataset([ | ||
rdf.quad(start, ns.list, listNode), | ||
rdf.quad(listNode, ns.first, rdf.literal('1')), | ||
rdf.quad(listNode, ns.first, rdf.literal('3')), | ||
rdf.quad(listNode, ns.rest, ns.nil) | ||
]) | ||
const cf = clownface({ dataset }) | ||
assert.throws(() => { | ||
[...cf.out(ns.list).list()] // eslint-disable-line no-unused-expressions | ||
}) | ||
}) | ||
it('should throw when a list node has multiple rdf:rest', () => { | ||
const start = rdf.blankNode() | ||
const listNode = rdf.blankNode() | ||
console.log(rdf.nil) | ||
const dataset = rdf.dataset([ | ||
rdf.quad(start, ns.list, listNode), | ||
rdf.quad(listNode, ns.first, rdf.literal('1')), | ||
rdf.quad(listNode, ns.rest, rdf.blankNode()), | ||
rdf.quad(listNode, ns.rest, ns.nil) | ||
]) | ||
const cf = clownface({ dataset }) | ||
assert.throws(() => { | ||
[...cf.out(ns.list).list()] // eslint-disable-line no-unused-expressions | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92772
2175