(root: Object, obj: Object)
| 77 | } |
| 78 | |
| 79 | export function _getPathRecursive(root: Object, obj: Object): string { |
| 80 | let found; |
| 81 | for (let key in root) { |
| 82 | if (hasOwnProperty(root, key)) { |
| 83 | if (root[key] === obj) { |
| 84 | return escapePathComponent(key) + '/'; |
| 85 | } |
| 86 | else if (typeof root[key] === 'object') { |
| 87 | found = _getPathRecursive(root[key], obj); |
| 88 | if (found != '') { |
| 89 | return escapePathComponent(key) + '/' + found; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | return ''; |
| 95 | } |
| 96 | |
| 97 | export function getPath(root: Object, obj: Object): string { |
| 98 | if (root === obj) { |
no test coverage detected