(leafMap: LeafMap)
| 2 | import { pathToParts } from "./store-helpers/helpers"; |
| 3 | |
| 4 | const leafMapToEndpoints = (leafMap: LeafMap): Array<Endpoint> => { |
| 5 | const endpoints: Array<Endpoint> = []; |
| 6 | for (const [host, pathData] of Object.entries(leafMap)) { |
| 7 | for (const [path, leaf] of Object.entries(pathData)) { |
| 8 | const endpoint: Endpoint = { |
| 9 | host, |
| 10 | parts: pathToParts(path), |
| 11 | pathname: path, |
| 12 | data: leaf.data, |
| 13 | }; |
| 14 | endpoints.push(endpoint); |
| 15 | } |
| 16 | } |
| 17 | return endpoints; |
| 18 | }; |
| 19 | |
| 20 | export default leafMapToEndpoints; |
no test coverage detected