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

rdf-parser-jsonld

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-parser-jsonld - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

12

lib/ParserStream.js

@@ -9,3 +9,4 @@ const concat = require('concat-stream')

super({
objectMode: true
objectMode: true,
read: () => {}
})

@@ -15,9 +16,6 @@

this.input = input
this.baseIRI = options.baseIRI || ''
this.factory = options.factory || rdf
this.blankNodes = {}
}
_read () {
const concatStream = concat({encoding: 'string'}, (data) => {

@@ -37,7 +35,7 @@ if (!data) {

this.input.on('error', (err) => {
input.pipe(concatStream)
input.on('error', (err) => {
this.emit('error', err)
})
this.input.pipe(concatStream)
}

@@ -44,0 +42,0 @@

{
"name": "rdf-parser-jsonld",
"version": "1.0.0",
"version": "1.0.1",
"description": "JSON-LD parser that implements the RDFJS Sink interface using jsonld.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,2 +7,3 @@ /* global describe, it */

const JSONLDParser = require('..')
const Readable = require('readable-stream')

@@ -318,2 +319,68 @@ describe('rdf-parser-jsond', () => {

})
it('should register the error handler only once', () => {
let count = 0
const input = new Readable({
read: () => {}
})
input._on = input.on
input.on = (event, param) => {
if (event === 'error') {
count++
}
input._on(event, param)
}
const parser = new JSONLDParser()
const stream = parser.import(input)
stream.resume()
input.push('{')
input.push('"http://example.org/predicateA": "0",')
input.push('"http://example.org/predicateB": "0"')
input.push('}')
input.push(null)
return rdf.waitFor(stream).then(() => {
assert.equal(count, 2) // +1 for waitFor
})
})
it('should register the data handler only once', () => {
let count = 0
const input = new Readable({
read: () => {}
})
input._on = input.on
input.on = (event, param) => {
if (event === 'data') {
count++
}
input._on(event, param)
}
const parser = new JSONLDParser()
const stream = parser.import(input)
stream.resume()
input.push('{')
input.push('"http://example.org/predicateA": "0",')
input.push('"http://example.org/predicateB": "0"')
input.push('}')
input.push(null)
return rdf.waitFor(stream).then(() => {
assert.equal(count, 1)
})
})
})
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