-
Notifications
You must be signed in to change notification settings - Fork 202
Updates to indexing #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to indexing #334
Conversation
// If compactedItem contains a single entry | ||
// whose key maps to @id, recompact without @type | ||
if(Object.keys(compactedItem).length === 1 && '@id' in expandedItem) { | ||
compactedItem = await api.compact({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just get the alias for @id
here and pull out the value compactedItem[alias]
without having to run compact again? Or is it the case that it could have used a different value based on the presence of @type
(via scoped contexts or something?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not easily, as if reduced to a node reference, it can be turned into a string. If not, it remains a node object. We could conceivably implement that logic there, but that's what expand is for, and it should be pretty quick in that case.
Modulo my comment this PR seems ok to me so far. @davidlehn ? |
@type
requires@type
to be either@id
or@vocab
, and defaults to@id
.@index
.