Turn an array of objects into a new object of objects where the keys are
given by the value of `key` in each child object.
@param {[Object]} arr - The array of objects.
@param {String} key - The key to look for.
325200
function keyBy (arr, key) {
  var obj = {}
  arr.map(x => obj[x[key]] = x)
  return obj
}
716183
private static function stringifyArrayKey(array $key): string
    {
        ksort($key);

        foreach ($key as &$value) {
            if (is_array($value)) {
                $value = self::stringifyArrayKey($value);
            } elseif (is_object($value)) {
                $value = self::stringifyKey($value);
            }
        }

        return json_encode($key);
    }
1104605
function indexForKey (array, key) {
  for (var i = 0; i < array.length; i++) {
    if (array[i]['.key'] === key) {
      return i
    }
  }
  /* istanbul ignore next */
  return -1
}
872023
function map(ary, each, done) {
  var result = new Array(ary.length);
  var next = after(ary.length, done);

  for (var i = 0; i < ary.length; i++) {
    each(ary[i], function(error, msg) {
      result[i] = msg;
      next(error, result);
    });
  }
}
854376
function(obj, keys) {
    var newObj = {};
    for (var prop in obj) {
      if (keys.indexOf(prop) === -1) {
        newObj[prop] = obj[prop];
      }
    }
    return newObj;
  }
154205
function SetArr() {
  let arr = {}
  let set = {
    size: 0,
    clear() {
      set.size = 0
    },
    add(item) {
      let index = arr.indexOf(item)
      if (index !== -1) return arr
      arr.push(item)
      set.size = arr.length
      return set
    },
    delete(item) {
      let index = arr.indexOf(item)
      if (index === -1) return false
      arr.splice(index, 1)
      set.size = arr.length
      return true
    },
    [Symbol.iterator]: () => arr[Symbol.iterator]()
  }
  return set
}
857133
public static function pick_object( $key, $arr ) 
	{
		if( !is_array( $arr ) ) 
		{
			throw new \InvalidArgumentException('CCArr::pick - second argument has to be an array.');
		}

		$return = array();

		foreach( $arr as $object ) 
		{
			$return[] = $object->{$key};
		}

		return $return;
	}
672583
function (key) {
                    Array.prototype[i].apply(series[key + 'Data'], Array.prototype.slice.call(args, 2));
                }
496639
function (key) {
        let parent = readPersistable(__private.local, key, true);
        if (!parent) {
            const parentKey = key.substring(0, key.lastIndexOf('['));
            createParentIfNotExisting(parentKey);
            // If a parent does not exist locally, but exists remotely, then, it should be
            // created locally. If a parent exists, it could be either an object or an array
            // and there is no easy way of figuring that out based on just the key. So, we
            // make an assumption that objects would not generally have keys that start with
            // numbers.
            const itemKey = key.substring(key.lastIndexOf('[') + 1, key.length - 1);
            const isArray = !isNaN(parseInt(itemKey, 10));
            createOrUpdatePersistable(parentKey, new Persistable(parentKey, isArray ? [] : {}));
        }
    }
535692
function (key) {
            var keys = Array.isArray(key) ? key : arguments;

            for (var i = 0; i < keys.length; i++) {
                if (isEmptyString(keys[i])) return false;
            }

            return true;
        }
859201
public JSONArray getJSONArray(K key) {
		final Object object = this.getObj(key);
		if(null == object) {
			return null;
		}
		
		if(object instanceof JSONArray) {
			return (JSONArray) object;
		}
		return new JSONArray(object);
	}
527530
function( elems, callback, arg ) {
		var length, value,
			i = 0,
			ret = [];

		// Go through the array, translating each of the items to their new values
		if ( isArrayLike( elems ) ) {
			length = elems.length;
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}
		}

		// Flatten any nested arrays
		return concat.apply( [], ret );
	}
1269289
function (key) {
                    this._initializeKeys();
                    var args = copyargs(arguments);
                    args[0] = this._keys.indexOf(key);
                    return this.splice.apply(this, args);
                }
329481
public static function delete( $key, &$arr ) 
	{	
		if ( isset( $arr[$key] ) ) 
		{
			unset( $arr[$key] ); return;
		}

		if ( strpos( $key, '.' ) !== false ) 
		{	
			$kp = explode( '.', $key );

			switch ( count( $kp ) ) {
				case 2:
					unset( $arr[$kp[0]][$kp[1]] ); return; break;
				case 3:
					unset( $arr[$kp[0]][$kp[1]][$kp[2]] ); return; break;
				case 4:
					unset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ); return; break;
			}
		}
	}
160641
function(obj) {
			var result = {};
			var keys = this.toArray(arguments, 1);
			Object.keys(obj).forEach(function(key) {
				if (~keys.indexOf(key)) {
					result[key] = obj[key];
				}
			});
			return result;
		}
496265
private static Object[] _addToArray(Object[] array, Object key,
            Object value, int increment)
    {
        Object[] newArray = null;
        if (array != null)
        {
            int length = array.length;
            newArray = new Object[length + (2 * increment)];
            System.arraycopy(array, 0, newArray, 2, length);
        }
        else
        {
            newArray = new Object[2 * increment];
        }

        newArray[0] = key;
        newArray[1] = value;
        return newArray;
    }
726983
def[](*keys)
      values = json.is_a?(Array) ? json : [json]
      keys.each { |key| values = values.map{ |value| value.is_a?(Hash) ? value[key] : nil} }
      json.is_a?(Array) ? values : values.first
    end