Skip to content

Commit

Permalink
chore: fix NMS-23504
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Oct 15, 2024
1 parent 41f6b99 commit e488654
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions example/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const arrayToItems = (array: any[]): AgoraDropdownItem[] => {
};

export const enumToItems = (enumType: any): AgoraDropdownItem[] => {
const items = Object.values(enumType);
const keys = items.filter((v) => typeof v === 'string') as string[];
const values = items.filter((v) => typeof v === 'number') as number[];
return keys.map((value, index) => ({
label: value,
value: values[index],
const entries = Object.entries(enumType);
const items = entries.filter(([, value]) => typeof value === 'number');
items.sort((a: any, b: any) => a[1] - b[1]);
return items.map(([key, value]) => ({
label: key,
value: value,
}));
};

Expand Down

0 comments on commit e488654

Please sign in to comment.