Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 2x 5x 5x 20x 5x | interface OptionsItem extends Record<string, unknown> {
label?: string | number;
value?: string | number
}
/**
* map 结构转 array
* @param map
*/
export const translateMapToArray = (map: Map<number | string, string | number>): OptionsItem[] => {
let array: OptionsItem[] = [];
for (const [key, value] of map.entries()) {
array.push({
label: key,
value
});
}
return array;
}; |