(hops: readonly TrailHop[])
| 44 | } |
| 45 | |
| 46 | export function encodeTrail(hops: readonly TrailHop[]): string { |
| 47 | return hops.map((h) => DIR_TO_CHAR[h.dir] + encodeURIComponent(h.id)).join(','); |
| 48 | } |
| 49 | |
| 50 | export function decodeTrail(encoded: string | null): TrailHop[] { |
| 51 | if (!encoded) return []; |