(obj: any, path: any)
| 32 | * @private |
| 33 | */ |
| 34 | export function getBy(obj: any, path: any) { |
| 35 | const pathObj = makePathArray(path) |
| 36 | return pathObj.reduce((current: any, pathPart: any) => { |
| 37 | if (current === null) return null |
| 38 | if (typeof current !== 'undefined') { |
| 39 | return current[pathPart] |
| 40 | } |
| 41 | return undefined |
| 42 | }, obj) |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Set a value on an object using a path, including dot notation. |
no test coverage detected