Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rdfjs/parser-jsonld

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rdfjs/parser-jsonld - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

FsDocumentLoader.js

3

lib/ParserStream.js

@@ -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')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc