( currentHash: string, newHash: Record<string, string | undefined>, )
| 18 | |
| 19 | // Given the current hash and a record of string->strings, creates the new hash |
| 20 | export function createHash( |
| 21 | currentHash: string, |
| 22 | newHash: Record<string, string | undefined>, |
| 23 | ): string { |
| 24 | const current = parseHash(currentHash); |
| 25 | const combined = { ...current, ...newHash }; |
| 26 | return `#${Object.entries(combined) |
| 27 | .filter(([_, value]) => { |
| 28 | return value !== undefined; |
| 29 | }) |
| 30 | .map(([key, value]) => { |
| 31 | return `${key}=${value}`; |
| 32 | }) |
| 33 | .join("&")}`; |
| 34 | } |
| 35 | |
| 36 | export function zxyFromHash(s: string): [number, number, number] | undefined { |
| 37 | const split = s.split("/"); |
no test coverage detected
searching dependent graphs…