Gets the value at any depth in a nested object based on the path described by the keys given. Keys may be given as an array or as a dot-separated string.
165193
function getPath (obj, ks) {
      ks = typeof ks == "string" ? keysFromPath(ks) : ks;

      var i = -1, length = ks.length;

      // If the obj is null or undefined we have to break as
      // a TypeError will result trying to access any property
      // Otherwise keep incrementally access the next property in
      // ks until complete
      while (++i < length && obj != null) {
        obj = obj[ks[i]];
      }
      return i === length ? obj : void 0;
    }
1051190
function _getPathKey (target, key, includeNonEnumerables) {
    if (includeNonEnumerables && key in Object(target) || _isEnumerable(target, key)) {
        return key;
    }

    var n = +key;
    var len = target && target.length;

    return n >= -len && n < len ? n < 0 ? n + len : n : void 0;
}
1351136
function getDeepRef() {
  var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var path = arguments.length > 1 ? arguments[1] : undefined;
  var keys = getKeysFromPath(path);
  if (!keys.length) return target;
  var obj = target;

  while (obj && keys.length > 1) {
    obj = obj[keys.shift()];
  }

  var key = keys.shift();

  if (obj && obj.hasOwnProperty(key)) {
    return obj[key];
  }
}
1091009
def get(self, key):
        ""
        if key in self.keys():
            return self[key]
        else:
            res = None
            for v in self.values():
                # This could get weird if the actual expected returned value
                # is None, especially in teh case of overlap. Any ambiguity
                # would be resolved by get_path(s).
                if hasattr(v, 'get'):
                    res = v.get(key)
                if res is not None:
                    break
            return res
605793
function getPathParts(path) {
  // split the path specified into an array on `.`
  const pathParts = String(path).split('.');

  // create an empty array which will be the result
  const parts = [];

  // create an index variable so we can skip indexes if
  // need be when parsing the paths
  let index = 0;

  // while the index is smaller then the parts array length
  while (index < pathParts.length) {
    // get the part from the parts array
    let parsedPart = pathParts[index];

    // while (if) the part starts with `\` remove it and
    // append `.` and then next part from the array to it
    // this should result in `test\\.test` being parsed
    // into `test.test`. This is done so users can escape
    // dots from the dot notation
    while (parsedPart[parsedPart.length - 1] === '\\'
          && pathParts[index + 1] !== undefined
          && pathParts[index + 1] !== null) {
      // remove `\` and append the `.`
      parsedPart = `${parsedPart.slice(0, -1)}.`;
      // increase the index so next iteration it will skip
      // the next path which is about to be added to this path
      index += 1;
      // add the next path to the current one because they are
      // apart of the same object key
      parsedPart += pathParts[index];
    }

    // increase the index so we can continue to the next path
    // in the array
    index += 1;

    // append the parsed path to the results array
    parts.push(parsedPart);
  }

  // return all the parsed paths
  return parts;
}
548070
def values_at(self, depth):
        
        if depth < 1:
            yield self
        else:
            for dict_tree in self.values():
                for value in dict_tree.values_at(depth - 1):
                    yield value
1368316
function getNodeVaue(path, obj) {
    // Gets a value from a JSON object
    // vcard[0].url[0]
    var output = null;
    try {
        var arrayDots = path.split(".");
        for (var i = 0; i < arrayDots.length; i++) {
            if (arrayDots[i].indexOf('[') > -1) {
                // Reconstructs and adds access to array of objects
                var arrayAB = arrayDots[i].split("[");
                var arrayName = arrayAB[0];
                var arrayPosition = Number(arrayAB[1].substring(0, arrayAB[1].length - 1));

                if (obj[arrayName] != null || obj[arrayName] != 'undefined') {
                    if (obj[arrayName][arrayPosition] != null || obj[arrayName][arrayPosition] != 'undefined')
                        obj = obj[arrayName][arrayPosition];

                }
                else {
                    currentObject = null;
                }

            }
            else {
                // Adds access to a property using property array ["given-name"]
                if (obj[arrayDots[i]] != null || obj[arrayDots[i]] != 'undefined')
                  obj = obj[arrayDots[i]];
            }
        }
        output = obj;
    } catch (err) {
        // Add error capture
        output = null;
    }
    return output;
}
207201
function getFromPath(obj, path){
		path = path.split('.');

		for(var i = 0, l = path.length; i < l; i++){
			if (hasOwnProperty.call(obj, path[i]))
				obj = obj[path[i]];
			
			else
				return undefined;
		}
		
		return obj;
	}
1090312
function deep_get(root, path) {
    var twig = root, result = undefined;
    path.split('/').forEach(function (branch, index, branches) {
        if (branch) {
            if (self.camelize) {
                branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); })
            }
            if (index < branches.length - 1) {
                twig = twig[branch];
            } else {
                result = twig && twig[branch];
            }
        }
    });
    return result;
}
1091066
function getValue(data, path) {
  if (typeof data !== 'object' || data === null) {
    return void 0;
  } else if (path.length === 1) {
    return data[path[0]];
  }
  return getValue(data[path[0]], path.slice(1));
}
921265
private static void getResPathKeys(String path, int num, String[] keys, int start) {
        if (num == 0) {
            return;
        }
        if (num == 1) {
            keys[start] = path;
            return;
        }
        int i = 0;
        for (;;) {
            int j = path.indexOf(RES_PATH_SEP_CHAR, i);
            assert j >= i;
            keys[start++] = path.substring(i, j);
            if (num == 2) {
                assert path.indexOf(RES_PATH_SEP_CHAR, j + 1) < 0;
                keys[start] = path.substring(j + 1);
                break;
            } else {
                i = j + 1;
                --num;
            }
        }
    }
276112
function getProp(obj, key) {
    var path = [].concat(key);
    var val = obj;
    for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
        var pathKey = path_1[_i];
        if (val[pathKey] === undefined) {
            return undefined;
        }
        val = val[pathKey];
    }
    return val;
}
871795
function valueFromPath(o, path = []) {
  return path.reduce((ret, seg) => isObject(ret) && ret[seg], o);
}
472875
def get_path(self, key):
        ""
        if key in self.keys():
            return (key,), self[key]
        else:
            key_path, res = (None, None)
            for sub_key, v in self.items():
                if isinstance(v, self.__class__):
                    key_path, res = v.get_path(key)
                elif hasattr(v, 'get'):
                    res = v.get(key)
                    key_path = (key,) if res is not None else None
                if res is not None and key_path is not None:
                    key_path = (sub_key,) + key_path
                    break
            return key_path, res
1104728
function(str) {
      var parameters = str.split('&'),
          obj = {},
          parameter,
          key,
          match,
          lastKey,
          subKey,
          depth;

      // Iterate over key/value pairs
      _.each(parameters, function(parameter) {
        parameter = parameter.split('=');
        key = urlDecode(parameter[0]);
        lastKey = key;
        depth = obj;

        // Reset so we don't have issues when matching the same string
        bracketRegex.lastIndex = 0;

        // Attempt to extract nested values
        while ((match = bracketRegex.exec(key)) !== null) {
          if (!_.isUndefined(match[1])) {

            // If we're at the top nested level, no new object needed
            subKey = match[1];

          } else {

            // If we're at a lower nested level, we need to step down, and make
            // sure that there is an object to place the value into
            subKey = match[2];
            depth[lastKey] = depth[lastKey] || (subKey ? {} : []);
            depth = depth[lastKey];
          }

          // Save the correct key as a hash or an array
          lastKey = subKey || _.size(depth);
        }

        // Assign value to nested object
        depth[lastKey] = urlDecode(parameter[1]);
      });

      return obj;
    }
1237464
def getobjpath(obj, path):
    
    if not path:
        return obj
    if path.startswith("["):
        item = path[1:path.index("]")]
        return getobjpath(obj[item], path[len(item) + 2:])
    if path.startswith("."):
        path = path[1:]
    if "." in path or "[" in path:
        dot_idx = path.find(".")
        bracket_idx = path.find("[")
        if dot_idx == -1 or bracket_idx < dot_idx:
            idx = bracket_idx
            next_idx = idx
        else:
            idx = dot_idx
            next_idx = idx + 1
        attr = path[:idx]
        return getobjpath(getattr(obj, attr), path[next_idx:])
    return getattr(obj, path)
191908
def _get(self, key: bytes) -> Tuple[bytes, Tuple[Hash32]]:
        
        validate_is_bytes(key)
        validate_length(key, self._key_size)
        branch = []

        target_bit = 1 << (self.depth - 1)
        path = to_int(key)
        node_hash = self.root_hash
        # Append the sibling node to the branch
        # Iterate on the parent
        for _ in range(self.depth):
            node = self.db[node_hash]
            left, right = node[:32], node[32:]
            if path & target_bit:
                branch.append(left)
                node_hash = right
            else:
                branch.append(right)
                node_hash = left
            target_bit >>= 1

        # Value is the last hash in the chain
        # NOTE: Didn't do exception here for testing purposes
        return self.db[node_hash], tuple(branch)