use array methods only on arrays

This commit is contained in:
Clement Zhang
2024-11-18 16:15:12 +01:00
parent 8fcf5de0b8
commit 30ac3d3679
@@ -74,6 +74,9 @@
}
function findOptionsByValue(values: any[]) {
if (!Array.isArray(values)) {
return []
}
return options?.filter((item) => {
let itemValue = item.value
try {
@@ -95,7 +98,7 @@
}
function toValues(options: ObjectOption[] | undefined) {
if (!options) {
if (!options || !Array.isArray(options)) {
return []
}