MCPcopy Index your code
hub / github.com/atomicdata-dev/atomic-data-browser / propertyLine

Function propertyLine

react/src/useMarkdown.ts:66–90  ·  view source on GitHub ↗
(
  propertySubject: string,
  value: JSONValue,
  store: Store,
)

Source from the content-addressed store, hash-verified

64}
65
66async function propertyLine(
67 propertySubject: string,
68 value: JSONValue,
69 store: Store,
70): Promise<string> {
71 const property = await store.getProperty(propertySubject);
72 let valString = value.toString();
73 switch (property.datatype) {
74 case Datatype.ATOMIC_URL:
75 valString = `[${value}](${value})`;
76 break;
77 case Datatype.RESOURCEARRAY:
78 {
79 valString = '';
80 valToArray(value).map(item => {
81 valString = valString + `[${item}](${item}),`;
82 });
83 }
84 break;
85 case Datatype.TIMESTAMP:
86 valString = valToDate(value).toLocaleString();
87 break;
88 }
89 return `\n\n**${property.shortname}**: ${valString}`;
90}

Callers 1

getPropValTextsFunction · 0.85

Calls 3

valToArrayFunction · 0.90
valToDateFunction · 0.90
getPropertyMethod · 0.80

Tested by

no test coverage detected