(IDorName: string | number)
| 506 | } |
| 507 | |
| 508 | export function getGroup(IDorName: string | number): GroupOptions | undefined { |
| 509 | const settings = get(); |
| 510 | const byID = settings.groups[IDorName]; |
| 511 | |
| 512 | if (byID) { |
| 513 | return {...byID, ID: Number(IDorName)}; |
| 514 | } |
| 515 | |
| 516 | for (const [ID, group] of Object.entries(settings.groups)) { |
| 517 | if (group.friendly_name === IDorName) { |
| 518 | return {...group, ID: Number(ID)}; |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | return undefined; |
| 523 | } |
| 524 | |
| 525 | function getGroupThrowIfNotExists(IDorName: string): GroupOptions { |
| 526 | const group = getGroup(IDorName); |
no test coverage detected