_deepGet.js 280 B

12345678910
  1. // Internal function to obtain a nested property in `obj` along `path`.
  2. export default function deepGet(obj, path) {
  3. var length = path.length;
  4. for (var i = 0; i < length; i++) {
  5. if (obj == null) return void 0;
  6. obj = obj[path[i]];
  7. }
  8. return length ? obj : void 0;
  9. }