Skip to content

Extracting Collections and Related #1845

Answered by retorquere
stefanopagliari asked this question in Q&A
Discussion options

You must be logged in to vote

The collections are available as item.collections which is an array of keys; the details of the collections are available as Translator.collections, addressable by key. If you want all collection names in the field collections you'd do

reference.add({ name: 'collections', value: item.collections.map(key => Translator.collections[key].name), sep: ', ' })

but since collections always carry all their collection keys, but only the collections being exported are actually exposed to the translator, you need to check whether they exist, and it'd become

reference.add({ name: 'collections', value: item.collections.map(key => Translator.collections[key] && Translator.collections[key].name).filter(…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@retorquere
Comment options

@stefanopagliari
Comment options

@retorquere
Comment options

@stefanopagliari
Comment options

@retorquere
Comment options

Answer selected by retorquere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants