I have the following code:
render () {
const namesPointer = this.dataPointer().out([this.predicate])
// My question is about the following three lines.
const indexSpecificNamesPointer = namesPointer.clone({
ptrs: [namesPointer.ptrs[this.index]].filter(Boolean)
}).trim().out([schema('name'), rdfs('label')])
const name = bestLanguage(indexSpecificNamesPointer, this.uiLanguagePriorities)
this.innerHTML = `<h2>${name ?? this.value?.value} <em>(blank node)</em></h2>`
}
A possible syntax might be:
render () {
const namesPointer = this.dataPointer()
.out([this.predicate])
.index(this.index)
.out([schema('name'), rdfs('label')])
const name = bestLanguage(indexSpecificNamesPointer, this.uiLanguagePriorities)
this.innerHTML = `<h2>${name ?? this.value?.value} <em>(blank node)</em></h2>`
}
What do you think? Is something like this already in the library or would you be open to a PR for this?
I have the following code:
A possible syntax might be:
What do you think? Is something like this already in the library or would you be open to a PR for this?