MCPcopy
hub / github.com/soybeanjs/soybean-admin / transformRecordToOption

Function transformRecordToOption

src/utils/common.ts:21–26  ·  view source on GitHub ↗
(record: T)

Source from the content-addressed store, hash-verified

19 * @param record
20 */
21export function transformRecordToOption<T extends Record<string, string>>(record: T) {
22 return Object.entries(record).map(([value, label]) => ({
23 value,
24 label
25 })) as CommonType.Option<keyof T, T[keyof T]>[];
26}
27
28/**
29 * Translate options

Callers 2

common.tsFile · 0.90
app.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected