Skip to content

Commit 6299a59

Browse files
committed
refactor: better deal with nullish values
1 parent 9855b4e commit 6299a59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/composables/useFormKitSection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { computed } from 'vue'
33

44
export function useFormKitSection(context: any) {
55
const hasPrefix = computed(() => {
6-
return context?.prefix && context?.prefix.length > 0
6+
return Boolean(context?.prefix?.length > 0)
77
})
88

99
const hasPrefixIcon = computed(() => {
10-
return context?.iconPrefix && context?.iconPrefix.length > 0
10+
return Boolean(context?.iconPrefix?.length > 0)
1111
})
1212

1313
const hasSuffixIcon = computed(() => {
14-
return context?.iconSuffix && context?.iconSuffix.length > 0
14+
return Boolean(context?.iconSuffix?.length > 0)
1515
})
1616

1717
const hasSuffix = computed(() => {
18-
return context?.suffix && context?.suffix.length > 0
18+
return Boolean(context?.suffix?.length > 0)
1919
})
2020

2121
function generateId() {

0 commit comments

Comments
 (0)