MCPcopy Create free account
hub / github.com/solidjs/solid-router / shallowDiff

Function shallowDiff

src/index.tsx:158–170  ·  view source on GitHub ↗
(prev: Params, next: Params, set: SetStoreFunction<any>, key: string)

Source from the content-addressed store, hash-verified

156};
157
158function shallowDiff(prev: Params, next: Params, set: SetStoreFunction<any>, key: string) {
159 const prevKeys = Object.keys(prev);
160 const nextKeys = Object.keys(next);
161 for (let i = 0; i < prevKeys.length; i++) {
162 const k = prevKeys[i];
163 if (next[k] == null) set(key, k, undefined as any);
164 }
165 for (let i = 0; i < nextKeys.length; i++) {
166 const k = nextKeys[i];
167 if (next[k] !== prev[k]) set(key, k, next[k] as any);
168 }
169 return { ...next };
170}
171
172function createRouter(
173 routes: RouteDefinition[],

Callers 1

createRouterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…