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

Function parseProfileFormHint

packages/shared/src/graphql/users.ts:453–475  ·  view source on GitHub ↗
(
  message?: string,
)

Source from the content-addressed store, hash-verified

451// Null unless the message parses into an object of strings; the same mutations
452// also throw plain-string ValidationErrors
453export const parseProfileFormHint = (
454 message?: string,
455): ProfileFormHint | null => {
456 if (!message) {
457 return null;
458 }
459
460 try {
461 const parsed = JSON.parse(message);
462
463 if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
464 return null;
465 }
466
467 return Object.fromEntries(
468 Object.entries(parsed).filter(
469 (entry): entry is [string, string] => typeof entry[1] === 'string',
470 ),
471 );
472 } catch {
473 return null;
474 }
475};
476
477export const mutateUserInfo = async (
478 data: Partial<UserProfile>,

Callers 3

users.spec.tsFile · 0.90
useProfileFormFunction · 0.90
useUserInfoFormFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected