utility function to get nested property
169323
function dig(obj, selector) {
        var result = obj;
        var splitter = selector.split('.');

        for (var i = 0; i < splitter.length; i++) {
          if (typeof result === 'undefined' || result === null) {
            return undefined;
          }

          result = result[splitter[i]];
        }

        return result;
      }
1361361
function() {
    var result = {}, i, attr;
    for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers
        for (attr in arguments[i]) {
            if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") {
                result[attr] = arguments[i][attr];
            }
        }
    }
    return result;
}
347847
def map_nested(function, data_struct, dict_only=False, map_tuple=False):
  """"""

  # Could add support for more exotic data_struct, like OrderedDict
  if isinstance(data_struct, dict):
    return {
        k: map_nested(function, v, dict_only, map_tuple)
        for k, v in data_struct.items()
    }
  elif not dict_only:
    types = [list]
    if map_tuple:
      types.append(tuple)
    if isinstance(data_struct, tuple(types)):
      mapped = [map_nested(function, v, dict_only, map_tuple)
                for v in data_struct]
      if isinstance(data_struct, list):
        return mapped
      else:
        return tuple(mapped)
  # Singleton
  return function(data_struct)
890065
function parseObject(obj) {
    const proto = {};
    const nestProtos = {};
    const tags = {};

    for (const name in obj) {
        if (obj.hasOwnProperty(name)) {
            const tag = obj[name];
            const params = name.split(' ');

            switch (params[0]) {
            case 'message':
                if (params.length === 2) {
                    nestProtos[params[1]] = parseObject(tag);
                }
                break;
            case 'required':
            case 'optional':
            case 'repeated': {
                // params length should be 3 and tag can't be duplicated
                if (params.length === 3 && !tags[tag]) {
                    proto[params[2]] = {
                        option: params[0],
                        type: params[1],
                        tag: tag
                    };
                    tags[tag] = params[2];
                }
                break;
            }
            default:
                break;
            }
        }
    }

    proto.__messages = nestProtos;
    proto.__tags = tags;
    return proto;
}
25198
function (src) {
        var res = {};
        for (var k in src) {
            if (src.hasOwnProperty(k)) {
                res[k] = src[k];
            }
        }
        return res;
    }
640294
function getPropertyValue(obj, path) {

   if (path.length === 0 || obj === undefined) {
      return undefined;
   }
   var notation = dotNotation(path);
   if (!notation) {
      return;
   }
   path = notation.path;
   for (var i = 0; i < path.length; i++) {
      obj = obj[path[i]];
      if (obj === undefined) {
         return undefined;
      }
   }
   return obj;
}
407883
function(prop, def) {
    def = def ? def : _.result(this, 'definition');

    return _.reduce(def, function(attrs, attr, key) {
      if (attr.type === 'object') {
        var nested = this.findAttributes(prop, attr.fields || {});
        if (!_.isEmpty(nested)) {
          attrs[key] = nested;
        }
      } if (attr[prop]) {
        attrs[key] = true;
      }
      return attrs;
    }.bind(this), {});
  }
182295
def get_nested_dicts_with_key_value(parent_dict: dict, key, value):
    """"""
    references = []
    NestedLookup(parent_dict, references, NestedLookup.key_value_equality_factory(key, value))
    return (document for document, _ in references)
976846
def nested_map(x, f):
  """"""
  if isinstance(x, list):
    return [nested_map(y, f) for y in x]
  if isinstance(x, tuple):
    return tuple([nested_map(y, f) for y in x])
  if isinstance(x, dict):
    return {k: nested_map(x[k], f) for k in x}
  return f(x)
851853
function reformatProperty(next) {
    const self = this;
    paths.forEach(function(path) {
      try {
        const splitted = path.path.split('.');
        const key      = splitted.shift();
        const value    = determineValue(splitted, self[key]);

        self[key]      = nest(splitted, value);
      } catch (error) { return next(error); }
    });

    next();
  }
97227
function (object, property) {
        return utils.getProp(object, Array.prototype.slice.call(arguments, 1).join("."));
    }
374184
function getPath(pathType = 'array', _path) {
  return {
    _path: _path || (pathType === 'array' ? [] : ''),
    set(parent, key) {
      let nextPath;
      switch (pathType) {
        case 'array':
          nextPath = this._path.concat([key]);
          break;

        case 'nestedProperty':
          if (this._path.length === 0) {
            nextPath = key;
          } else if (Array.isArray(parent)) {
            nextPath = this._path + `[${key}]`;
          } else {
            nextPath = this._path + '.' + key;
          }
          break;

        default:
          throw new Error('unrecognized pathType ' + pathType);
      }

      return getPath(pathType, nextPath);
    },

    get(parent, key) {
      // in array mode we do not return the leaf node key.
      if (pathType === 'array') {
        return this._path;
      }

      // in nestedProperty mode we return full path including final key
      return this.set(parent, key)._path;
    },
  };
}
1103103
function nestedPath (obj, path, val) {
  if (typeof obj !== 'object') {
    return obj
  }
  var keys = path.split('.')
  if (keys.length > 1) {
    path = keys.shift()
    return nestedPath(obj[path], keys.join('.'), val)
  }
  if (val !== undefined) {
    obj[path] = val
  }
  return obj[path]
}
339511
def get_property(self, key):
        """"""
        _key = DJANGO_CONF[key]
        return getattr(self, _key, CONF_SPEC[_key])
898853
def recursive_get(obj, key):
    '''
    
    '''
    if not obj or not key:
        return
    parts = key.split('.') if isinstance(key, basestring) else key
    key = parts.pop(0)
    if isinstance(obj, dict):
        value = obj.get(key, None)
    else:
        value = getattr(obj, key, None)
    return recursive_get(value, parts) if parts else value
1229330
function(property) {
            if (this.hasOwnProperty(property) && !_.isUndefined(this[property])) {
                return this[property];
            }

            if (this.__proto && this.__proto.hasOwnProperty(property) && !_.isUndefined(this.__proto[property])) {
                return this.__proto[property];
            }

            var parent = this.__parent;

            while (parent) {
                if (parent.hasOwnProperty(property) && !_.isUndefined(parent[property])) {
                    return parent[property];
                }
                parent = parent.__parent;
            }
        }
820465
function getValue(obj, prop) {
  var tmp = obj[prop]; if(tmp !== undefined) return tmp
  var segs = prop
  if(!Array.isArray(prop)) segs = prop.split('.')
  var len = segs.length
  var i = -1
  while (obj && (++i < len)) obj = obj[segs[i]]
  return obj
}