* Get the value of a property which may be multiple levels down * in the object. * @param {?PlainObject} obj * @param {string[]} keys * @returns {undefined|boolean|string|number|external:AST}
(obj, keys)
| 33 | * @returns {undefined|boolean|string|number|external:AST} |
| 34 | */ |
| 35 | function getPath(obj, keys) { |
| 36 | for (let i = 0; i < keys.length; ++i) { |
| 37 | if (obj == null) { return obj; } |
| 38 | obj = obj[keys[i]]; |
| 39 | } |
| 40 | return obj; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Determine whether `node` can be reached by following `path`, |