MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / generateText

Function generateText

core/src/components/select/select.tsx:1300–1316  ·  view source on GitHub ↗
(
  opts: HTMLIonSelectOptionElement[],
  value: any | any[],
  compareWith?: string | SelectCompareFn | null
)

Source from the content-addressed store, hash-verified

1298};
1299
1300const generateText = (
1301 opts: HTMLIonSelectOptionElement[],
1302 value: any | any[],
1303 compareWith?: string | SelectCompareFn | null
1304) => {
1305 if (value === undefined) {
1306 return '';
1307 }
1308 if (Array.isArray(value)) {
1309 return value
1310 .map((v) => textForValue(opts, v, compareWith))
1311 .filter((opt) => opt !== null)
1312 .join(', ');
1313 } else {
1314 return textForValue(opts, value, compareWith) || '';
1315 }
1316};
1317
1318const textForValue = (
1319 opts: HTMLIonSelectOptionElement[],

Callers 1

getTextMethod · 0.85

Calls 1

textForValueFunction · 0.85

Tested by

no test coverage detected