sanity-plugin-media
Version:
This version of `sanity-plugin-media` is for Sanity Studio V3.
17 lines (14 loc) • 375 B
text/typescript
import type {TagSelectOption, TagItem} from '../types'
const getTagSelectOptions = (tags: TagItem[]): TagSelectOption[] => {
return tags.reduce((acc: TagSelectOption[], val) => {
const tag = val?.tag
if (tag) {
acc.push({
label: tag?.name?.current,
value: tag?._id
})
}
return acc
}, [])
}
export default getTagSelectOptions