Map an array or map

@param {Array|List|Map|OrderedMap} arr
@param {Function(element, key)}
@return {Promise<List|Map|OrderedMap>}
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);
        });
    }
}
118226
@ObjectiveCName("flatMap:")
    public <R> Promise<R> flatMap(final Function<T, Promise<R>> res) {
        final Promise<T> self = this;
        return new Promise<>((PromiseFunc<R>) resolver -> {
            self.then(t -> {
                Promise<R> promise;
                try {
                    promise = res.apply(t);
                } catch (Exception e) {
                    e.printStackTrace();
                    resolver.tryError(e);
                    return;
                }

                promise.then(t2 -> resolver.result(t2));
                promise.failure(e -> resolver.error(e));
            });
            self.failure(e -> resolver.error(e));
        });
    }
690087
function array2booleanMap(array)
{
	var i,map,numElements;
	
	if (Array.isArray(array) === true)
	{
		map = {};
		numElements = array.length;
		
		for (i=0; i<numElements; i++)
		{
			map[ array[i] ] = true;
		}
		
		return map;
	}
	
	// Unknown input -- return
	return array;
}
1237822
function _mapArray(data, schema, options) {
    var base = [];
    if (data instanceof Array && options.keep) {
        base = _clone(data);
    }
    if (typeof data === 'object' && options.keep) {
        base = Object
            .keys(data)
            .map(function(key) {
                return data[key];
            });
    }
    return schema
        .reduce(function (memo, nestedSchema) {
            memo.push(_mapDataValue(data, nestedSchema));
            return memo;
        }, base);
}
1350625
function toSet(arr) {
  const set = {};
  arr.forEach((e) => (set[e] = true));
  return set;
}
262734
function(array, fn) {
        if (typeof array.map == "function") {
          return array.map(fn);
        } else {
          var r = [];
          var l = array.length;
          for(var i = 0; i < l; i++) {
            r.push(fn(array[i]));
          }
          return r;
        }
      }
216266
function eachSeries(arr, fun) {
  return arr.reduce(function (p, e) {
    return p.then(function () {
      return fun(e);
    });
  }, _promise2.default.resolve());
}
741240
public static Collection map(Mapper mapper, Object[] arr) {
        return map(mapper, arr, false);
    }
1371340
function map(arr, iterator) {
    var result = [], i;
    if (Array.prototype.map) {
      return Array.prototype.map.call(arr, iterator);
    }
    for (i = 0; i < arr.length; i++) {
      result.push(iterator(arr[i]));
    }
    return result;
  }
544460
function ensureAnArray (arr) {
        if (Object.prototype.toString.call(arr) === '[object Array]') {
            return arr;
        } else if (arr === null || arr === void 0) {
            return [];
        } else {
            return [arr];
        }
    }
786057
function (arr) {
      var r = [];
      var push = function (x) {
        r.push(x);
      };
      for (var i = 0; i < arr.length; i++) {
        arr[i].each(push);
      }
      return r;
    }
377786
def _map_promise(map_fn, all_inputs):
  """"""
  all_promises = utils.map_nested(map_fn, all_inputs)  # Apply the function
  res = utils.map_nested(_wait_on_promise, all_promises)
  return res
160551
public static function to_map($arr, $keyField = null, $valueField = null)
    {
        $map = [];
        if ($valueField) {
            foreach ($arr as $row) {
                if ($keyField) {
                    $map[$row[$keyField]] = $row[$valueField];
                } else {
                    $map[] = $row[$valueField];
                }
            }
        } else {
            foreach ($arr as $row) {
                if ($keyField) {
                    $map[$row[$keyField]] = $row;
                } else {
                    $map[] = $row;
                }
            }
        }
        return $map;
    }
1072772
function(arr) {
      var n = [], l=arr.length,i;
      for(i = 0 ; i < l ; i++) {
         if( !lang.isNull(arr[i]) && !lang.isUndefined(arr[i]) ) {
            n.push(arr[i]);
         }
      }
      return n;
   }
1330144
function iterateArray(array) {
  return ArrayCompiler.compileArray(array.map(function(obj) {
    return iterate(obj);
  }), data);
}
737778
function (arr) {
        this.array[0] = arr[0];
        this.array[1] = arr[1];
        this.array[2] = arr[2];
        this.array[3] = arr[3];

        this._dirty = true;
        return this;
    }
325200
function keyBy (arr, key) {
  var obj = {}
  arr.map(x => obj[x[key]] = x)
  return obj
}