MCPcopy Create free account
hub / github.com/protomaps/PMTiles / createHash

Function createHash

app/src/utils.ts:20–34  ·  view source on GitHub ↗
(
  currentHash: string,
  newHash: Record<string, string | undefined>,
)

Source from the content-addressed store, hash-verified

18
19// Given the current hash and a record of string->strings, creates the new hash
20export 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
36export function zxyFromHash(s: string): [number, number, number] | undefined {
37 const split = s.split("/");

Callers 4

PageTileFunction · 0.90
PageArchiveFunction · 0.90
PageMapFunction · 0.90
handlerRawFunction · 0.85

Calls 1

parseHashFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…