export default function safeTraverse (obj, paths = []) {
  let val = obj;
  let idx = 0;

  while (idx < paths.length) {
    if (!val) {
      return null;
    }
    val = val[paths[idx]];
    idx++;
  }
  return val;
}
