Comparing version 1.0.0-alpha to 1.0.0-beta.1
@@ -19,6 +19,6 @@ // N3.js implementations of the RDF/JS core data types | ||
// ### Makes this class a subclass of the given type | ||
Term.subclass = function subclass(Type) { | ||
Term.subclass = function subclass(Type, name) { | ||
Type.prototype = Object.create(this.prototype, { | ||
constructor: { value: Type }, | ||
termType: { value: Type.name }, | ||
termType: { value: name || Type.name }, | ||
}); | ||
@@ -103,3 +103,3 @@ Type.subclass = subclass; | ||
} | ||
Term.subclass(NamedNode); | ||
Term.subclass(NamedNode, 'NamedNode'); | ||
@@ -118,3 +118,3 @@ // ### The IRI of this named node | ||
} | ||
Term.subclass(BlankNode); | ||
Term.subclass(BlankNode, 'BlankNode'); | ||
@@ -133,3 +133,3 @@ // ### The name of this blank node | ||
} | ||
Term.subclass(Variable); | ||
Term.subclass(Variable, 'Variable'); | ||
@@ -148,3 +148,3 @@ // ### The name of this variable | ||
} | ||
Term.subclass(Literal); | ||
Term.subclass(Literal, 'Literal'); | ||
@@ -216,3 +216,3 @@ // ### The text value of this literal | ||
} | ||
Term.subclass(DefaultGraph); | ||
Term.subclass(DefaultGraph, 'DefaultGraph'); | ||
@@ -219,0 +219,0 @@ // Initialize singleton |
@@ -284,4 +284,6 @@ // **N3Parser** parses N3 documents. | ||
// Regular literal, can still get a datatype or language | ||
if (token.prefix.length === 0) | ||
if (token.prefix.length === 0) { | ||
this._literalValue = token.value; | ||
return this._readDataTypeOrLang; | ||
} | ||
// Pre-datatyped string literal (prefix stores the datatype) | ||
@@ -426,4 +428,6 @@ else | ||
// Regular literal, can still get a datatype or language | ||
if (token.prefix.length === 0) | ||
if (token.prefix.length === 0) { | ||
this._literalValue = token.value; | ||
next = this._readListItemDataTypeOrLang; | ||
} | ||
// Pre-datatyped string literal (prefix stores the datatype) | ||
@@ -484,3 +488,2 @@ else { | ||
_completeLiteral: function (token, listItem) { | ||
var value = this._lexer.previousToken.value; | ||
switch (token.type) { | ||
@@ -492,3 +495,3 @@ // Create a datatyped literal | ||
if (datatype === undefined) return; // No datatype means an error occurred | ||
this._object = this._literal(value, datatype); | ||
this._object = this._literal(this._literalValue, datatype); | ||
token = null; | ||
@@ -498,3 +501,3 @@ break; | ||
case 'langcode': | ||
this._object = this._literal(value, token.value); | ||
this._object = this._literal(this._literalValue, token.value); | ||
token = null; | ||
@@ -504,3 +507,3 @@ break; | ||
default: | ||
this._object = this._literal(value); | ||
this._object = this._literal(this._literalValue); | ||
} | ||
@@ -507,0 +510,0 @@ // If this literal was part of a list, write the item |
19
N3.js
@@ -1,7 +0,2 @@ | ||
// Replace local require by a lazy loader | ||
var globalRequire = require; | ||
require = function () {}; | ||
// Expose submodules | ||
var exports = module.exports = { | ||
module.exports = { | ||
DataFactory: require('./lib/N3DataFactory'), | ||
@@ -16,13 +11,1 @@ Lexer: require('./lib/N3Lexer'), | ||
}; | ||
// Load submodules on first access | ||
Object.keys(exports).forEach(function (submodule) { | ||
Object.defineProperty(exports, submodule, { | ||
configurable: true, | ||
enumerable: true, | ||
get: function () { | ||
delete exports[submodule]; | ||
return exports[submodule] = globalRequire('./lib/N3' + submodule); | ||
}, | ||
}); | ||
}); |
{ | ||
"name": "n3", | ||
"version": "1.0.0-alpha", | ||
"version": "1.0.0-beta.1", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -30,6 +30,6 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", | ||
"eslint": "^4.1.1", | ||
"follow-redirects": "^1.4.1", | ||
"mocha": "^5.0.1", | ||
"nyc": "^11.0.3", | ||
"pre-commit": "^1.2.2", | ||
"request": "^2.74.0" | ||
"pre-commit": "^1.2.2" | ||
}, | ||
@@ -36,0 +36,0 @@ "scripts": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
0
124636
2660
1