mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-25 14:20:21 +08:00
perf(projects): use transformObjectToOption to generate option of object labels
This commit is contained in:
6
src/constants/_shared.ts
Normal file
6
src/constants/_shared.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export function transformObjectToOption<T extends object>(obj: T) {
|
||||
return Object.entries(obj).map(([value, label]) => ({
|
||||
value,
|
||||
label
|
||||
})) as Common.OptionWithKey<keyof T>[];
|
||||
}
|
||||
Reference in New Issue
Block a user