Merge branch 'master' into isolated-vm

This commit is contained in:
Sam Rose 2024-01-24 17:37:43 +00:00 committed by GitHub
commit 309605bf4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,7 @@
export let getOptionIcon = () => null
export let getOptionColour = () => null
export let getOptionSubtitle = () => null
export let compare = (option, value) => option === value
export let compare = null
export let useOptionIconImage = false
export let isOptionEnabled
export let readonly = false
@ -40,9 +40,10 @@
if (!options?.length) {
return ""
}
const index = options.findIndex((option, idx) =>
compare(getOptionValue(option, idx), value)
)
const index = options.findIndex((option, idx) => {
const opt = getOptionValue(option, idx)
return typeof compare === "function" ? compare(opt, value) : opt === value
})
return index !== -1 ? getAttribute(options[index], index) : null
}