@rdfjs/parser-jsonld
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -46,3 +46,3 @@ import rdf from '@rdfjs/data-model' | ||
class ParserStream { | ||
constructor (input, { baseIRI = relativeIriProtocol, context = null, factory = rdf } = {}) { | ||
constructor (input, { baseIRI = relativeIriProtocol, context = null, documentLoader, factory = rdf } = {}) { | ||
const parser = new JsonLdParser({ | ||
@@ -52,2 +52,3 @@ baseIRI, | ||
dataFactory: factory, | ||
documentLoader, | ||
streamingProfile: false | ||
@@ -54,0 +55,0 @@ }) |
{ | ||
"name": "@rdfjs/parser-jsonld", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "JSON-LD parser that implements the RDFJS Sink interface using jsonld.js", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -7,2 +7,3 @@ import { rejects, strictEqual } from 'assert' | ||
import chunks from 'stream-chunks/chunks.js' | ||
import FsDocumentLoader from '../FsDocumentLoader.js' | ||
import JSONLDParser from '../index.js' | ||
@@ -352,2 +353,23 @@ | ||
}) | ||
it('should use a given documentLoader', async () => { | ||
const example = JSON.stringify({ | ||
'@context': 'http://example.org/', | ||
'@id': 'subject', | ||
predicate: 'object' | ||
}) | ||
const documentLoader = new FsDocumentLoader({ | ||
'http://example.org/': 'test/support/example.org.json' | ||
}) | ||
const parser = new JSONLDParser({ documentLoader }) | ||
const stream = parser.import(Readable.from(example)) | ||
const output = await chunks(stream) | ||
strictEqual(output.length, 1) | ||
strictEqual(output[0].predicate.termType, 'NamedNode') | ||
strictEqual(output[0].predicate.value, 'http://example.org/predicate') | ||
}) | ||
}) |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
19479
9
429
2