* Groups schemas by their domain. * @param {Array<{ url: string }>} schemas - The schemas to group. * @returns {Record >} - The grouped schemas.
(schemas)
| 98 | * @returns {Record<string, Array<{ url: string }>>} - The grouped schemas. |
| 99 | */ |
| 100 | function groupByDomain(schemas) { |
| 101 | const grouped = /** @type {Record<string, Array<{ url: string }>>} */ ({}) |
| 102 | |
| 103 | for (const schema of schemas) { |
| 104 | const domain = extractDomain(schema.url) |
| 105 | if (!grouped[domain]) { |
| 106 | grouped[domain] = [] |
| 107 | } |
| 108 | grouped[domain].push(schema) |
| 109 | } |
| 110 | |
| 111 | return grouped |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Parses a $schema URI into a format string. |
nothing calls this directly
no test coverage detected