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

Function parseStoredFlags

packages/shared/src/contexts/SettingsContext.tsx:202–215  ·  view source on GitHub ↗
(
  raw: string | null,
)

Source from the content-addressed store, hash-verified

200);
201
202const parseStoredFlags = (
203 raw: string | null,
204): Partial<SettingsFlags> | null => {
205 try {
206 const parsed = JSON.parse(raw);
207 // A non-object (truncated write, key reused by another build) would blow
208 // up the `in` checks below.
209 return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
210 ? parsed
211 : null;
212 } catch (err) {
213 return null;
214 }
215};
216
217const readStoredFlags = (userId?: string): Partial<SettingsFlags> => {
218 const stored = parseStoredFlags(

Callers 1

readStoredFlagsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected