Retrieve an index of keys present in an array of objects
191336
function keysIndex(a) {
    var keys = [],
        l,
        k,
        i;

    for (i = 0, l = a.length; i < l; i++)
      for (k in a[i])
        if (!~keys.indexOf(k))
          keys.push(k);

    return keys;
  }
61327
function keyInArray(keys) {
  var keySet = Immutable.Set(keys);
  return function (v, k) {

    return keySet.has(k);
  }
}
543368
function keyBy(arr, fn){
        var result = {};
        arr.forEach(function(v){
            result[fn(v)] = v;
        });
        return result;
    }
1077005
def convert_key_to_index(keys, key):
    '''
    
    '''
    index = _key_to_index(keys, key)
    single = isinstance(index, int)
    return index, single
593361
def keys
      map { |line| line.kind_of?(Array) ? line.first.key : line.key }
    end
821947
function () {
        var keys = Object.keys(this),
            i = -1,
            len = keys.length,
            values = [];

        while (++i < len) {
            values.push(this[keys[i]]);
        }

        return values;
    }
1119287
function (key) {
            var modelVal = this.getModelVal();
            modelVal = this.multiple ? modelVal : [modelVal];
            return (_.indexOf(_.map(modelVal, toStr), toStr(key)) > -1);
        }
814712
function keys(object) {
        var ks = [], prop;
        for (prop in object) {
            if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); }
        }
        return ks;
    }
1036282
private int findIndex(Object key, Object[] array) {
        int length = array.length;
        int index = getModuloHash(key, length);
        int last = (index + length - 1) % length;
        while (index != last) {
            if (array[index] == key || array[index] == null) {
                /*
                 * Found the key, or the next empty spot (which means key is not
                 * in the table)
                 */
                break;
            }
            index = (index + 1) % length;
        }
        return index;
    }
246385
def _index_list_of_values(d, k):
    """"""
    v = d[k]
    if isinstance(v, list):
        return v
    return [v]
1042190
function getIterableObjectEntries(obj) {

  let index = 0;
  const propKeys = Reflect.ownKeys(obj);

  return {
    [Symbol.iterator]() {
      return this;
    },
    next() {

      if (index < propKeys.length) {

        const key = propKeys[index];

        index += 1;
        return {"value": [key, obj[key]]};
      }

      return {"done": true};
    }
  };
}
10710
def get_values_to_index_from(obj)

      # if it's an array, we collect the values for its elements recursive
      if obj.is_a? Array
        return obj.map { |element| get_values_to_index_from element }.flatten.compact
      end

      # if the object responds to attributes and attributes is a hash,
      # we use the attributes values (works well for active_record and datamapper objects)
      return obj.attributes.values.compact if obj.respond_to?(:attributes) && obj.attributes.is_a?(Hash)

      # The object is unkown and will be indexed by its to_s method; if to_s retruns nil, we
      # will not index it
      obj.to_s.nil? ? [] : [obj]
    end
1071
def nested_get(dictionary, keys):
    
    return reduce(lambda d, k: d[k], keys, dictionary)
388417
function findIndex (array, item) {
  return array
    .map(function (i) {
      return i.toLowerCase()
    })
    .indexOf(item.toLowerCase())
}
1038195
function keysIndexes(children, startIndex, endIndex) {
  var i, keys = Object.create(null), key;
  for (i = startIndex; i <= endIndex; ++i) {
    if (children[i]) {
      key = children[i].key;
      if (key !== undefined) {
        keys[key] = i;
      }
    }
  }
  return keys;
}
371642
def get_index(self, key):
        
        try:
            return self[self.index_lookup.get(key)]

        except TypeError:
            raise KeyError
700166
function findWhereKey(arr, key) {

  return arr.find(elem => {

    for (const [k] of getIterableObjectEntries(elem)) {

      if (k === key) {
        return true;
      }
    }
  });
}