MCPcopy Create free account
hub / github.com/dailydotdev/apps / visit

Function visit

packages/shared/src/features/patchy/patchyAssistant.ts:261–283  ·  view source on GitHub ↗
(value: unknown, depth: number)

Source from the content-addressed store, hash-verified

259): PatchyQuickRead[] => {
260 const found = new Map<string, Post>();
261 const visit = (value: unknown, depth: number) => {
262 if (!value || typeof value !== 'object' || depth > 8) {
263 return;
264 }
265 if (isPostLike(value)) {
266 if (
267 value.readTime > 0 &&
268 value.readTime <= PATCHY_QUICK_READ_MINUTES &&
269 value.read === false &&
270 value.id !== excludeId &&
271 (!tag || !!value.tags?.some((postTag) => postTag === tag)) &&
272 (!isBookmarked || !!value.bookmarked)
273 ) {
274 found.set(value.id, value);
275 }
276 return;
277 }
278 if (Array.isArray(value)) {
279 value.forEach((item) => visit(item, depth + 1));
280 return;
281 }
282 Object.values(value).forEach((item) => visit(item, depth + 1));
283 };
284 client
285 .getQueryCache()
286 .findAll({

Callers 1

getPatchyQuickReadsFunction · 0.70

Calls 1

isPostLikeFunction · 0.85

Tested by

no test coverage detected