MCPcopy Create free account
hub / github.com/hashintel/hash / propertyMetadata

Method propertyMetadata

libs/@local/graph/sdk/typescript/src/entity.ts:1365–1382  ·  view source on GitHub ↗
(path: PropertyPath)

Source from the content-addressed store, hash-verified

1363 }
1364
1365 public propertyMetadata(path: PropertyPath): PropertyMetadata | undefined {
1366 return path.reduce<PropertyMetadata | undefined>((map, key) => {
1367 if (!map || !("value" in map)) {
1368 return undefined;
1369 }
1370 if (typeof key === "number") {
1371 if (Array.isArray(map.value)) {
1372 return map.value[key];
1373 } else {
1374 return undefined;
1375 }
1376 } else if (!Array.isArray(map.value)) {
1377 return map.value[key];
1378 } else {
1379 return undefined;
1380 }
1381 }, this.#entity.metadata.properties);
1382 }
1383
1384 public flattenedPropertiesMetadata(): {
1385 path: PropertyPath;

Callers 6

getHistoryEventsFunction · 0.80
entity.test.tsFile · 0.80

Calls 1

reduceMethod · 0.80

Tested by

no test coverage detected