n3 2.7.5 → 2.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/n3.esm.min.js +2 -2
- package/browser/n3.min.js +2 -2
- package/lib/N3Lexer.js +1 -0
- package/lib/N3StreamParser.js +8 -6
- package/package.json +1 -1
- package/src/N3Lexer.js +2 -0
- package/src/N3StreamParser.js +6 -2
package/lib/N3Lexer.js
CHANGED
|
@@ -464,6 +464,7 @@ class N3Lexer {
|
|
|
464
464
|
// ### `_unescape` replaces N3 escape codes by their corresponding characters,
|
|
465
465
|
// allowing only the fixed escape sequences from the given replacement table
|
|
466
466
|
_unescape(item, replacements) {
|
|
467
|
+
if (item.indexOf('\\') < 0) return item;
|
|
467
468
|
let invalid = false;
|
|
468
469
|
const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {
|
|
469
470
|
// 4-digit unicode character
|
package/lib/N3StreamParser.js
CHANGED
|
@@ -59,15 +59,17 @@ class N3StreamParser extends _readableStream.Transform {
|
|
|
59
59
|
|
|
60
60
|
// ### Parses a stream of strings
|
|
61
61
|
import(stream) {
|
|
62
|
-
stream.on('data', chunk => {
|
|
63
|
-
this.write(chunk);
|
|
64
|
-
});
|
|
65
|
-
stream.on('end', () => {
|
|
66
|
-
this.end();
|
|
67
|
-
});
|
|
68
62
|
stream.on('error', error => {
|
|
69
63
|
this.emit('error', error);
|
|
70
64
|
});
|
|
65
|
+
if (typeof stream.pipe === 'function') stream.pipe(this);else {
|
|
66
|
+
stream.on('data', chunk => {
|
|
67
|
+
this.write(chunk);
|
|
68
|
+
});
|
|
69
|
+
stream.on('end', () => {
|
|
70
|
+
this.end();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
71
73
|
return this;
|
|
72
74
|
}
|
|
73
75
|
}
|
package/package.json
CHANGED
package/src/N3Lexer.js
CHANGED
|
@@ -485,6 +485,8 @@ export default class N3Lexer {
|
|
|
485
485
|
// ### `_unescape` replaces N3 escape codes by their corresponding characters,
|
|
486
486
|
// allowing only the fixed escape sequences from the given replacement table
|
|
487
487
|
_unescape(item, replacements) {
|
|
488
|
+
if (item.indexOf('\\') < 0)
|
|
489
|
+
return item;
|
|
488
490
|
let invalid = false;
|
|
489
491
|
const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {
|
|
490
492
|
// 4-digit unicode character
|
package/src/N3StreamParser.js
CHANGED
|
@@ -38,9 +38,13 @@ export default class N3StreamParser extends Transform {
|
|
|
38
38
|
|
|
39
39
|
// ### Parses a stream of strings
|
|
40
40
|
import(stream) {
|
|
41
|
-
stream.on('data', chunk => { this.write(chunk); });
|
|
42
|
-
stream.on('end', () => { this.end(); });
|
|
43
41
|
stream.on('error', error => { this.emit('error', error); });
|
|
42
|
+
if (typeof stream.pipe === 'function')
|
|
43
|
+
stream.pipe(this);
|
|
44
|
+
else {
|
|
45
|
+
stream.on('data', chunk => { this.write(chunk); });
|
|
46
|
+
stream.on('end', () => { this.end(); });
|
|
47
|
+
}
|
|
44
48
|
return this;
|
|
45
49
|
}
|
|
46
50
|
}
|