Map the indices of the array to the respective elements.

    Parameters
    -----------
    arr : list(a)
        The array to process, of generic type a

    Returns
    -----------
    dict(int -> a), a dictionary corresponding the index to the element
5535
def index_element_map(arr):
    
    index_to_element = {}
    for index, element in enumerate(arr):
        index_to_element[index] = element
    return index_to_element
11318
function mapSeries(arr, iterator) {
		var self = this,
			length = arr.length,
			index = 0;

		return Promise.reduce(arr, function(values, item) {
		    return Promise.resolve(iterator.call(self, item, index, length))
			.then(function(value) {
		        values[index] = value;
				index++;
		        return values;
		    });
		}, []);
	}
836864
function toArray(obj) {
  var a, arr = [];
  for (a in obj) {
    arr.push(obj[a]);
  }
  return arr;
}
905328
function arrDel(arr, indexArr) {
	// check params
	if (arr == null) {
    	return [];
  	}else if(Object.prototype.toString.call(arr) !== "[object Array]"){
  		throw new TypeError('PARAM MUST BE ARRAY');
  	}
  	if(indexArr == null){
		return arr
	}else if(Object.prototype.toString.call(indexArr) !== "[object Array]"){
		throw new TypeError('PARAM MUST BE ARRAY');
	}
	var arrLen = arr.length;
	for(var i=0, len=indexArr.length; i < len; i++){
		if(typeof indexArr[i] !== "number"){
			throw new TypeError('PARAM MUST BE NUMBER ARRAY');
		}
		if(Math.abs(indexArr[i]) > arrLen){
			indexArr[i] = arrLen + 1;
		}
		if(indexArr[i] >= -arrLen && indexArr[i] < 0){
			indexArr[i] = indexArr[i] + arrLen;
		}
	}
	// first sort indexArr, then remove redupliction
	indexArr.sort(function(a, b){
		return a - b
	})
	var tmpArr = [];
	for(var i=0, len=indexArr.length; i < len; i++){
		if(tmpArr.indexOf(indexArr[i]) == -1){
			tmpArr.push(indexArr[i])
		}
	}
	// should not change the value of input arr
	var outArr = JSON.parse(JSON.stringify(arr));
	if (arr.length === 0) {
		return [];
	}
	for (var i = 0, len = tmpArr.length; i < len; i++) {
		outArr.splice(tmpArr[i] - i, 1);
	}
	return outArr
}
631912
public static List<String> strArrayToList(String[] arr) {
		List<String> result = new ArrayList<String>();
		if (arr == null || arr.length == 0)
			return result;
		for (String str : arr)
			result.add(str);
		return result;
	}
314528
function mapAsList(arr, iter) {
    return reduce(arr, function(prev, entry, i) {
        return Q(iter(entry, i))
        .then(function(out) {
            prev.push(out);
            return prev;
        });
    }, []);
}
144298
function flatten(arr) {
  if (!Array.isArray(arr)) {
    throw new Error('expected an array');
  }
  var result = [];
  var len = arr.length;
  for (var i = 0; i < len; i++) {
    var elem = arr[i];
    if (Array.isArray(elem)) {
      result.push.apply(result, flatten(elem));
    } else {
      result.push(elem);
    }
  }
  return result;
}
403732
def dict_to_numpy_array(d):
    
    return fromarrays(d.values(), np.dtype([(str(k), v.dtype) for k, v in d.items()]))
687817
def as_indexable(array):
    
    if isinstance(array, ExplicitlyIndexed):
        return array
    if isinstance(array, np.ndarray):
        return NumpyIndexingAdapter(array)
    if isinstance(array, pd.Index):
        return PandasIndexAdapter(array)
    if isinstance(array, dask_array_type):
        return DaskIndexingAdapter(array)
    raise TypeError('Invalid array type: {}'.format(type(array)))
348280
function map(arr, iter) {
    if (Immutable.Map.isMap(arr)) {
        var type = 'Map';
        if (Immutable.OrderedMap.isOrderedMap(arr)) {
            type = 'OrderedMap';
        }

        return mapAsList(arr, function(value, key) {
            return Q(iter(value, key))
            .then(function(result) {
                return [key, result];
            });
        })
        .then(function(result) {
            return Immutable[type](result);
        });
    } else {
        return mapAsList(arr, iter)
        .then(function(result) {
            return Immutable.List(result);
        });
    }
}
506021
def decode_numpy_dict_values(attrs: Mapping[K, V]) -> Dict[K, V]:
    
    attrs = dict(attrs)
    for k, v in attrs.items():
        if isinstance(v, np.ndarray):
            attrs[k] = v.tolist()
        elif isinstance(v, np.generic):
            attrs[k] = v.item()
    return attrs
1153145
public static <T> T[] listToArray(List<T> list, T[] array) {
        if (list == null || array == null) {
            return null;
        }

        return list.toArray(array);
    }
1365322
function mapArray(f, a, HASH_ID) {

  var b =  [];
  for (var i = 0; i < a.length; i++) {
    b[i] = {};
    // b[i].hash = f(typeof a[i] === "string"? a[i]: JSON.stringify(a[i]));
    b[i].hash = f(a[i], HASH_ID);
    b[i].index = i;
    b[i].value = a[i];
  }
  return b;
}
83037
def arrays(self):
        
        return list(chain.from_iterable(
            ([arr] if not isinstance(arr, InteractiveList) else arr.arrays
             for arr in self)))
1346542
def from_array(cls, arr):
        """"""
        return cls().with_columns([(f, arr[f]) for f in arr.dtype.names])
566939
private List<Object> convertArray(V8Array arr) {
		List<Object> l = new ArrayList<>();
		for (int i = 0; i < arr.length(); ++i) {
			Object o = arr.get(i);
			if (o instanceof V8Array) {
				o = convert((V8Array)o, List.class);
			} else if (o instanceof V8Object) {
				o = convert((V8Object)o, Map.class);
			}
			l.add(o);
		}
		return l;
	}
1024553
public static function map(array $arr, callable $callback): array
    {
        $arrResult = [];

        foreach ($arr as $index => $value) {
            $arrResult[] = $callback($value, $index);
        }

        return $arrResult;
    }