MCPcopy Index your code
hub / github.com/OHIF/Viewers / get

Method get

platform/core/src/utils/objectPath.js:52–80  ·  view source on GitHub ↗

* Get an object property based on "path" (namespace) supplied traversing the object * ... tree as necessary. * @param object {Object} An object where the properties specified might exist. * @param path {String} A string representing the property to be searched for, e.g. "user.study.series.t

(object, path)

Source from the content-addressed store, hash-verified

50 * @return {Any} The value of the property if found. By default, returns the special type "undefined".
51 */
52 static get(object, path) {
53 let found, // undefined by default
54 components = ObjectPath.getPathComponents(path),
55 length = components !== null ? components.length : 0;
56
57 if (length > 0 && ObjectPath.isValidObject(object)) {
58 let i = 0,
59 last = length - 1,
60 currentObject = object;
61
62 while (i < last) {
63 let field = components[i];
64
65 const isValid = ObjectPath.isValidObject(currentObject[field]);
66 if (field in currentObject && isValid) {
67 currentObject = currentObject[field];
68 i++;
69 } else {
70 break;
71 }
72 }
73
74 if (i === last && components[last] in currentObject) {
75 found = currentObject[components[last]];
76 }
77 }
78
79 return found;
80 }
81
82 /**
83 * Check if the supplied argument is a real JavaScript Object instance.

Callers 15

viewportGridReducerFunction · 0.45
ViewportGridProviderFunction · 0.45
DialogProviderFunction · 0.45
visibilityChangeCallbackFunction · 0.45
objectPath.test.jsFile · 0.45
constructorMethod · 0.45
setBasePathMethod · 0.45
DisplaySetServiceClass · 0.45

Calls 2

getPathComponentsMethod · 0.80
isValidObjectMethod · 0.80

Tested by 1

checkHpsBestMatchFunction · 0.36