MCPcopy Create free account
hub / github.com/GCWing/BitFun / getFieldValue

Function getFieldValue

src/web-ui/src/shared/utils/partialJsonParser.ts:37–44  ·  view source on GitHub ↗
(
  jsonStr: string,
  fieldName: string,
  defaultValue?: T,
)

Source from the content-addressed store, hash-verified

35}
36
37export function getFieldValue<T = any>(
38 jsonStr: string,
39 fieldName: string,
40 defaultValue?: T,
41): T | undefined {
42 const parsed = parsePartialJson(jsonStr);
43 return parsed[fieldName] !== undefined ? parsed[fieldName] : defaultValue;
44}
45
46export function getFirstAvailableField<T = any>(
47 jsonStr: string,

Callers

nothing calls this directly

Calls 1

parsePartialJsonFunction · 0.85

Tested by

no test coverage detected