rdf-parser-jsonld
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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) | ||
}) | ||
}) | ||
}) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14222
396
0