* 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)
| 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. |
no outgoing calls
no test coverage detected