Comparing version 1.7.0 to 1.8.0
@@ -83,2 +83,3 @@ "use strict"; | ||
this._graph = DEFAULTGRAPH; | ||
this._baseIRI = options.baseIRI; | ||
this._prefixIRIs = Object.create(null); | ||
@@ -159,6 +160,8 @@ options.prefixes && this.addPrefixes(options.prefixes); | ||
return 'id' in entity ? entity.id : `_:${entity.value}`; | ||
} // Escape special characters | ||
} | ||
let iri = entity.value; // Use relative IRIs if requested and possible | ||
let iri = entity.value; | ||
if (this._baseIRI && iri.startsWith(this._baseIRI)) iri = iri.substr(this._baseIRI.length); // Escape special characters | ||
if (escape.test(iri)) iri = iri.replace(escapeAll, characterReplacer); // Try to represent the IRI as prefixed name | ||
@@ -165,0 +168,0 @@ |
{ | ||
"name": "n3", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", |
@@ -58,2 +58,3 @@ // **N3Writer** writes N3 documents. | ||
this._graph = DEFAULTGRAPH; | ||
this._baseIRI = options.baseIRI; | ||
this._prefixIRIs = Object.create(null); | ||
@@ -149,4 +150,7 @@ options.prefixes && this.addPrefixes(options.prefixes); | ||
} | ||
let iri = entity.value; | ||
// Use relative IRIs if requested and possible | ||
if (this._baseIRI && iri.startsWith(this._baseIRI)) | ||
iri = iri.substr(this._baseIRI.length); | ||
// Escape special characters | ||
let iri = entity.value; | ||
if (escape.test(iri)) | ||
@@ -153,0 +157,0 @@ iri = iri.replace(escapeAll, characterReplacer); |
264924
5656