(symbols: readonly ExampleSymbol[])
| 89 | * nichts geladen ist: dann gibt es keine Beispiele. |
| 90 | */ |
| 91 | export function exampleSymbolOf(symbols: readonly ExampleSymbol[]): string | undefined { |
| 92 | const usable = symbols |
| 93 | .filter((symbol) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(symbol.name)) |
| 94 | .filter((symbol) => symbol.name.length >= EXAMPLE_SEARCH_LETTERS) |
| 95 | .filter((symbol) => !NOT_AN_EXAMPLE.includes(symbol.name)) |
| 96 | .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); |
| 97 | if (usable.length === 0) { |
| 98 | return undefined; |
| 99 | } |
| 100 | const callable = usable.find((symbol) => CALLABLE_KINDS.includes(symbol.kind)); |
| 101 | return (callable ?? usable[0]).name; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Die drei Beispiele zu einem Namen. |
no outgoing calls
no test coverage detected