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

n3

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n3 - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

9

lib/N3Lexer.js

@@ -9,3 +9,3 @@ // **N3Lexer** tokenizes N3 documents.

_prefix: /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=\s)/,
_qname: /^((?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=[\s\.;,)#])/,
_qname: /^((?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=[\s;,)#]|\.[\s#\(\[<"'])/,
_number: /^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d+\.\d+|\.\d+|\d+)(?=\s*[\s\.;,)#])/,

@@ -238,4 +238,7 @@ _boolean: /^(?:true|false)(?=[\s#,;.])/,

}
// Try to find a qname.
else if (match = this._qname.exec(input)) {
// Try to find a qname. Since it can contain (but not end with) a dot,
// we always need a non-dot character before deciding it is a qname.
// Therefore, try inserting a space if we're at the end of the input.
else if ((match = this._qname.exec(input)) ||
inputFinished && (match = this._qname.exec(input + ' '))) {
token.type = 'qname';

@@ -242,0 +245,0 @@ token.prefix = match[1] || '';

@@ -10,4 +10,2 @@ // **N3Parser** parses N3 documents.

var absoluteURI = /^[a-z]+:/,
absolutePath = /^\//,
hashURI = /^#/,
documentPart = /[^\/]*$/,

@@ -34,3 +32,3 @@ rootURI = /^(?:[a-z]+:\/*)?[^\/]*/;

else {
if (config.documentURI.match(/#/))
if (config.documentURI.indexOf('#') > 0)
throw new Error('Invalid document URI');

@@ -414,2 +412,4 @@ this._baseURI = config.documentURI;

return this._error('Expected explicituri to follow base declaration', token);
if (token.value.indexOf('#') > 0)
return this._error('Invalid base URI', token);
if (this._baseURI === null || absoluteURI.test(token.value))

@@ -456,7 +456,12 @@ this._baseURI = token.value;

_resolveURI: function (uri) {
if (hashURI.test(uri))
return this._baseURI + uri;
if (absolutePath.test(uri))
switch (uri[0]) {
case undefined:
return this._baseURI;
case '#':
return this._baseURI + uri;
case '/':
return this._baseURIRoot + uri;
return this._baseURIPath + uri;
default:
return this._baseURIPath + uri;
}
},

@@ -463,0 +468,0 @@

@@ -21,7 +21,8 @@ // **N3Writer** writes N3 documents.

// If the first argument is not a stream
if (!outputStream || !outputStream.write) {
// Shift arguments
prefixes = outputStream;
// Write to a string that will be given through the end callback
// Shift arguments if the first argument is not a stream
if (outputStream && typeof outputStream.write !== 'function')
prefixes = outputStream, outputStream = null;
// If no output stream given, send the output as string through the end callback
if (!outputStream) {
outputStream = this;

@@ -28,0 +29,0 @@ this._output = '';

{
"name": "n3",
"version": "0.2.5",
"version": "0.2.6",
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",

@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>",

@@ -315,2 +315,12 @@ var N3Lexer = require('../N3').Lexer;

it('should tokenize a qname with a dot, split in half while streaming',
shouldTokenize(streamOf('dbpedia:Anthony_J._Batt', 'aglia '),
{ type: 'qname', prefix: 'dbpedia', value: 'Anthony_J._Battaglia', line: 1 },
{ type: 'eof', line: 1 }));
it('should tokenize a qname with a dot, split after the dot while streaming',
shouldTokenize(streamOf('dbpedia:Anthony_J.', '_Battaglia '),
{ type: 'qname', prefix: 'dbpedia', value: 'Anthony_J._Battaglia', line: 1 },
{ type: 'eof', line: 1 }));
it('should tokenize a stream',

@@ -317,0 +327,0 @@ shouldTokenize(streamOf('<a>\n<b', '> ', '"""', 'c\n', '"""', '.',

@@ -362,2 +362,10 @@ var N3Parser = require('../N3').Parser;

it('should resolve URIs against a @base with query string',
shouldParse('@base <http://ex.org/?foo>.\n' +
'<> <b> <c>.\n' +
'@base <d/?bar>.\n' +
'<> <f> <g>.',
['http://ex.org/?foo', 'http://ex.org/b', 'http://ex.org/c'],
['http://ex.org/d/?bar', 'http://ex.org/d/f', 'http://ex.org/d/g']));
it('should not parse base declarations without IRI',

@@ -367,2 +375,7 @@ shouldNotParse('@base a: ',

it('should not parse invalid @base statements',
shouldNotParse('@base <http://ex.org/foo#bar>.\n' +
'<a> <b> <c>.\n',
'Invalid base URI at line 1.'));
it('should not parse improperly nested square brackets',

@@ -369,0 +382,0 @@ shouldNotParse('<a> <b> [<c> <d>]].',

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