MCPcopy Index your code
hub / github.com/parse-community/parse-server / getNestedProperty

Method getNestedProperty

src/Utils.js:531–544  ·  view source on GitHub ↗

* Gets a nested property value from an object using dot notation. * @param {Object} obj The object to get the property from. * @param {String} path The property path in dot notation, e.g. 'databaseOptions.allowPublicExplain'. * @returns {any} The property value or undefined if not found.

(obj, path)

Source from the content-addressed store, hash-verified

529 * // Output: true
530 */
531 static getNestedProperty(obj, path) {
532 if (!obj || !path) {
533 return undefined;
534 }
535 const keys = path.split('.');
536 let current = obj;
537 for (const key of keys) {
538 if (current == null || typeof current !== 'object') {
539 return undefined;
540 }
541 current = current[key];
542 }
543 return current;
544 }
545
546 /**
547 * Parses a human-readable size string into a byte count.

Callers 2

Utils.spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected