microdata-rdf-streaming-parser
Version:
A fast and lightweight streaming Microdata to RDF parser
21 lines • 817 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemPropertyHandlerUrl = void 0;
const relative_to_absolute_iri_1 = require("relative-to-absolute-iri");
/**
* Handler for an item property with a URL attribute.
*/
class ItemPropertyHandlerUrl {
constructor(tagName, attributeName) {
this.tagName = tagName;
this.attributeName = attributeName;
}
canHandle(tagName, attributes) {
return this.tagName === tagName && this.attributeName in attributes;
}
getObject(attributes, util, itemScope) {
return util.dataFactory.namedNode((0, relative_to_absolute_iri_1.resolve)(attributes[this.attributeName], util.baseIRI));
}
}
exports.ItemPropertyHandlerUrl = ItemPropertyHandlerUrl;
//# sourceMappingURL=ItemPropertyHandlerUrl.js.map