code: function getValue(item, keyOrPath) {
    const keys = keyOrPath.split('.');
    const used = [];
    while (keys.length > 0) {
      const key = keys.shift();
      used.push(key);
      if (!isValid(item[key])) {
        throw new Error(`path ${used.join('.')} is not an object`);
      }
      item = item[key];
    }
    return item[keys[0]];
  }
docs: --- getValue ... from singular property