rdf-object
Advanced tools
Comparing version 1.10.0 to 1.10.1
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
<a name="v1.10.1"></a> | ||
## [v1.10.1](https://github.com/rubensworks/rdf-object.js/compare/v1.10.0...v1.10.1) - 2021-03-04 | ||
### Fixed | ||
* [Fix stackoverflow when calling toQuads on cyclic Resources, Closes #28](https://github.com/rubensworks/rdf-object.js/commit/0d897660cf67dde8d1d8aedaaaedb0fdf6c17967) | ||
<a name="v1.10.0"></a> | ||
@@ -5,0 +11,0 @@ ## [v1.10.0](https://github.com/rubensworks/rdf-object.js/compare/v1.9.0...v1.10.0) - 2021-02-23 |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -54,3 +54,3 @@ import { JsonLdContextNormalized } from 'jsonld-context-parser'; | ||
*/ | ||
toQuads(quads?: RDF.BaseQuad[], dataFactory?: RDF.DataFactory<RDF.BaseQuad>): RDF.BaseQuad[]; | ||
toQuads(quads?: RDF.BaseQuad[], dataFactory?: RDF.DataFactory<RDF.BaseQuad>, excludeResources?: Record<string, boolean>): RDF.BaseQuad[]; | ||
} | ||
@@ -57,0 +57,0 @@ export interface IResourceArgs { |
@@ -102,3 +102,9 @@ "use strict"; | ||
*/ | ||
toQuads(quads = [], dataFactory = new rdf_data_factory_1.DataFactory()) { | ||
toQuads(quads = [], dataFactory = new rdf_data_factory_1.DataFactory(), excludeResources = {}) { | ||
// Circumvent infinite recursion by checking and maintaining emittedResources | ||
const resourceId = rdf_string_1.termToString(this.term); | ||
if (excludeResources[resourceId]) { | ||
return []; | ||
} | ||
excludeResources[resourceId] = true; | ||
// Handle predicates | ||
@@ -111,3 +117,3 @@ for (const [property, resources] of Object.entries(this.propertiesUri)) { | ||
quads.push(dataFactory.quad(subject, predicate, object)); | ||
resource.toQuads(quads, dataFactory); | ||
resource.toQuads(quads, dataFactory, excludeResources); | ||
} | ||
@@ -124,3 +130,3 @@ } | ||
quads.push(dataFactory.quad(chain, RdfListMaterializer_1.RdfListMaterializer.RDF_FIRST, element.term)); | ||
element.toQuads(quads, dataFactory); | ||
element.toQuads(quads, dataFactory, excludeResources); | ||
chainPrev = chain; | ||
@@ -127,0 +133,0 @@ chain = dataFactory.blankNode(); |
{ | ||
"name": "rdf-object", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"description": "Loads RDF as JSON objects", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"ts-jest": "^26.0.0", | ||
"typescript": "^3.0.1" | ||
"typescript": "^4.0.0" | ||
}, | ||
@@ -59,0 +59,0 @@ "jest": { |
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
46286
676